Used to use mobx-state-tree at a previous job, stopped using it after I left the Job, started checking it out in the last quarter of 2020 and was honestly impressed at how easy it was to setup mobx/mobx-state-tree using React context
setting up mobx with React Context feels just like the way you would setup React context + useReducer/useState as a state management tool, but instead you use a hook from mobx-react-lite called "useLocalObservable" to setup an observable state...
In the component where you need the state value, you get to read your state value from the context you created and in addition wrap the component with "observer" from mobx-react-lite to make the component re-render when the observable state in context changes...
Now the massive value from mobx is that you component gets to re-render only when "relevant observable to that component changes", something you would most likely have to rely on implementing selectors for, if you wished to get in Redux and the issue/complaint against..
context + useReducer/useState (although this is currently being addressed). so for almost setting up just just your normal react context and with the help of some little additional utilities from mobx you are getting an "observable state" that can be global in your app or can..
group several components in your app, while getting to re-render the components only when "observable state relevant to particular components changes". Also you don't have to necessarily have just one large context, but can create multiple domain based contexts...
mobx is unopinionated and allows you to perform a direct/mutable state update. If you wish to enforce some sort of immutability for better structure and predictability but still with the benefit that comes from mobx, you can rely on mobx-state-tree...
mobx-state-tree - described as "Full-featured reactive state management without the boilerplate." link to mobx and mobx-state-tree docs
mobx:
https://mobx.js.org/README.html 
mobx-state-tree: https://mobx-state-tree.js.org/intro/welcome 
You can follow @ChibuokemJ.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.