by danmaz74 · 9y ago · 0 comments
I think that React does the same? If a component's props and state don't change, shouldComponentUpdate doesn't get called at all IIRC. shouldComponentUpdate, instead, is useful when a state or prop was changed, but it's possible to quickly detect that the change won't require a DOM update anyway.
"When a component's props or state change, React decides whether an actual DOM update is necessary by comparing the newly returned element with the previously rendered one."
My point is that if a component doesn't receive a setState or new props it just doesn't start the rendering cycle at all (AFAIK), so shouldComponentUpdate doesn't get called at all.