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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.