DEV Community

Discussion on: React Context+Hooks API=> Ideal State Management

 
saswatamcode profile image
Saswata Mukherjee • Edited

Yup! Only components which subscribe to the Context changes, i.e, Consumers will re-render. However, Context should only be used when you require a few props to be available to a ton of components in a component tree, and prop drilling becomes cumbersome.

Thread Thread
 
markohologram profile image
Marko A

Yeah you are both right, my mistake...But still, the component will re-render even if the values that it's using from that Context instance don't change.

Still, it might be better to use multiple Context instances for multiple parts of the app, instead of having single Context provide bunch of values to many many components (eg. wrapping your whole app inside a single Context provider)