React’s Context API React Context allows us to have a state that can be seen globally to the entire application . We have to start with the context provider ( <Provider /> ) to define the data you want to be sending around and you need the context consumer ( <Consumer /> ) that grabs that data and uses it where called.
Read moreIs context the same as state?
Context is a mechanism designed to store data, and alert consumers when that data has changed. This kind of sounds like state, but isn’t quite the same . Context doesn’t have any rules around telling the Provider component itself when a change has occurred.
Read moreIs React context state management?
State colocation is a great strategy to keep your applications maintainable. Even leaving aside Context, React is a state management tool on its own , so the component state may be all that you need if you properly colocate your state.
Read more