I'm using react functional component in order to render 3 levels of component. The child is depent on props being passed by the grandparent. in my exanple below,, Child2 is keep rendering even only props.child1 is being updated. is there any way to avoid rendering of Child2 in case props.child2 value never changed? what is the best practice for this kind of scenario?
I'm not using redux, onlu hooks.
const Prandparent = () => {
return (
<Parent child1={props.child1}
child2={props.child2} />
)
};
const Parent = () => {
return (
<div>
<Child1 reportElasticLog={props.child1} />
<Child2 reportElasticLog={props.child2} />
</div>
);
};
Thanks,