Home > Mobile >  Rendering a Component in React.js
Rendering a Component in React.js

Time:10-02

I have a Small Query, I tried to google it but couldn't find the solution.

When a React Component state is changed(useState()), so the whole page is rendered or that specific React Component is rendered like in Ajax?

CodePudding user response:

Only the component will be rendered again.

CodePudding user response:

The useState will render all the components associated with it, meaning if you put the useState in the parent component it will also re-render the children component.

CodePudding user response:

When State changes in the child component do not affect the parent component, but when a parent component's state changes, all child components are rendered.

  • Related