DEV Community

Discussion on: Warped Re-rendering | React performance optimization

Collapse
 
aftabnack profile image
Aftab Khan

In this particular case, I am not moving the state out of the tree. I am still keeping the state properly at the right place in the tree, only the setting the state is happening from all over the place in my code base (In this example I am showing global loader, from different screens).

By keeping state restricted to loader component, I am re rendering only the loader component, which is what I intended when I called my showLoader function.