I have a parent component which looks like this:
const Parent = () => {
return (
<Child_1 />
<Child_2 />
);
}
if any changes occur in one of the child components, will the Parent component re-renders ?
CodePudding user response:
No, it will not re-render. If you pass any props to the component from the parent component and you update that prop in children or that prop update in the parent component so both will re-render. But if the data or state has no dependency on the parent component so it will not cause a re-render in the parent component.
CodePudding user response:
State changes in Child component doesn't effect on the parent component, but when a state of parent component changes all the child components render.