I am reading several articles about how to prevent react-redux from re-rendering the whole page, when only one little thing changes.
One article suggests that instead of wrapping all into one big container (as in figure 1 here) wrapping all into smaller containers (as in figure 2 here). If something changes in Container 2, only Component 2 and Component 3 are getting re-rendered. Component 1 would not re-render.
I have following questions:
- If I wrap everything in smaller containers, I would need "several" global states, for each
containerone (as indicated with the pseudo-code on the bottom of the figure). Is that common practice? - If it is ok to have "several" global states and I would need in some property from
Container1inContainer2, I would need to connect that with two global states. To me that feels like it could get messy very quick. Where does what come from? - When and where would I use the
reactmethodshouldComponentUpdate()? Using theBig Containerapproach how would I differ whichComponentshould be rerendered?! If implemented in theComponents, they would not be "dump" anymore, because they need to access the global state in order to decide whether to re-render or not. I would not be able to reuseComponentsbecause everyComponenthas its own special case when to rerender and when not. I am not sure where and when to useshouldComponentUpdate()
Please note that I am pretty new to this and might have made wrong assumptions etc. I basically want to know how not to re-render the whole page, when only one thing needs to be updated. The results from asking google differ a lot.

