Web Developer. Writer. Creator. On a spree of creative exploration!
I'm currently a student at SRMIST, pursuing ECE. I love coding, learning and making web development projects, reading and writing and creating YouTube videos.
Sure, the one I've used in this article is limited to a single complex state, so I use two contexts, one for the state and one for the dispatch function.
But if you plan to keep separate states, and retain the global functionality, you can create each context to deliver the state and the dispatch function in the same provider.
This is similar to how the Redux toolkit does, your slices map out to a state with their own reducer functions, only difference is, you have a common dispatch with the redux toolkit.
Sanchit Bajaj
Nice article but I want to ask whether this way of managing states with both useContext and useReducer scalable?