But more importantly, there is a solution to isolate updates that every React developer knows. No, it's not useMemo. Create a child component.
This part confused me, but I may have misunderstood what you were going for. Please correct me if I'm mistaken, but when a parent component re-renders, so will all of its children, unless those children:
Are pure components (available in class components).
Have a shouldComponentUpdate that always returns false (basically same as #1 but more explicit).
I'm over-generalizing. So apologize for the inaccuracy. That differs between VDOM implementations. Some do check the props directly. But you are correct that is what it means for React specifically.
This part confused me, but I may have misunderstood what you were going for. Please correct me if I'm mistaken, but when a parent component re-renders, so will all of its children, unless those children:
shouldComponentUpdate
that always returnsfalse
(basically same as #1 but more explicit).React.memo
HOC.I'm over-generalizing. So apologize for the inaccuracy. That differs between VDOM implementations. Some do check the props directly. But you are correct that is what it means for React specifically.
Ah, all good! I thought I'd misunderstood something.