DEV Community

Discussion on: Warped Re-rendering | React performance optimization

Collapse
 
markerikson profile image
Mark Erikson

There are multiple other ways to avoid having "the rest of the app" re-render here, including memoizing the rendered child component elements in App, wrapping the immediate child in React.memo(), and use of props.children.

Collapse
 
aftabnack profile image
Aftab Khan

Agreed Mark!

I am suggesting that apart from those optimizations, we can isolate the state & re-renders to the sub-tree where it is used. And if required, we can set it from anywhere in our code.

I am trying to establish that we shouldn't be lifting the state up only because we want to update the state from another place!