DEV Community

Discussion on: Getting Started with React useContext Hook and React Context

josprima profile image
Josprima Sihombing

Is it good if we have many context and wrapped the chilldren with many provider?

alexdevero profile image
Alex Devero Author

This is useful when you want to expose multiple types of data inside your app. When you expose all data through one provider, every change of one piece of the data will cause all subscribed children to re-render to update the UI. When you have multiple providers, each provider will trigger re-render only for its subscribed children. So, change of one provider will not affect children that are not subscribed to that provider.