useReducer + useContext for easy global state without libraries
What is this article about?
Ok so global state management, how do you do it? You grab Redux or MobX, or maybe Unstated or Constate and you’re done. Right?
All those libraries give you a global store to put your data, allow every component to access that state, and manage re-renders. You get some way of updating that state and life is good.
Sometimes there’s extra features.
But what if you don’t want to learn yet another library? You just wanna share some state between a bunch of components. What then?