4 ms·
How do you handle the drawback that changing the context will rerender all components that use the context? Putting too much state into a single context does se
by fabian2k 7y ago
How do you handle the drawback that changing the context will rerender all components that use the context? Putting too much state into a single context does seem like it could cause performance issues, especially with state that changes often.
- jerrycruncher 7y agoI agree that if you had a large (in the dozens, if not hundreds) number of dependent components, it could be an issue. However, I've noticed no performance degradation with my usage -- I use a top-level AuthContext component to handle user data/login state, and another for access/caching of the app's main data. In a single view (for lack of a better term), I'd guess the largest number of components that access either context is six.
- tjchear 7y agoI'd identify which states change often and group them into their own context(s).