React Context Limitations

React Context is great ! Let's use it for everything. Well, not quite. For one, keep in mind what I mentioned earlier. It can be great for app-wide or component-wide state so essentially states that affects multiple components. It's not a replacement for component configuration.
So props for configuration, context for state management across components or possibly across the entire app. But even then we have limitations, React Context is specifically not optimized for high frequency changes. So that means, for example, if you have state changes every second or multiple times per second. And if you had state changes that happen much more frequently, again, talking about multiple changes per second and so on, then React Context is not optimized for that and you don't have to take this for me. This is actually something that was stated by the official React team member.

So it's not great for high-frequency changes. Now, you might wonder, "Okay, but what if I have app-wide "or a component-wide state that changes often?" I would want to use Context for that. Props might not be ideal, and you're telling me that it's bad. We'll explore a better tool for that later. It will be called Redux . And as I mentioned, it should not be used to replace all component communications on props. Props are still vital and important for component configuration. So you should still use props for that and not use Context for everything. For replacing long prop chains it might however be worth the look.





