Member-only story
Frontend Tips 4— Super simple Global State Management in React with Hooks
In this tip I want to share how easy is nowadays to have stores in React, if you are not sure about Global State Management you can read some of these other articles: “An introduction to the Flux architectural pattern”, “The only introduction to Redux (and React-Redux) you’ll ever need”, “Introduction to Vuex”.
I personally have used some different libraries to solve this problem in different frameworks, for example: Vuex, Mobx, NgRx, Redux, Akita, etc.
And I’ve learned that all of them are good, they are simple different, depending on the framework and the project you can choose or another, in my opinion Global State Management have to be as simple as possible and libraries like Mobx, NgRx or Redux are more complex than others.
From version 16.8 React introduced Hooks, and with hooks they’ve provided us a very nice way work with states, reducers and contexts everywhere.
This movement was a game changer and made easier to create libraries to have Global State Management and also to create your own.
Back to basics
I like to remember how the Flux diagram looks like and remember the basics of Global State Management.