Re:MobX 6
by andy_ppp on Friday October 02, 2020 @02:43AM
(#24659660)
What do you do with state that needs to be global, or state that bits of start needing to be available in many components for example current username or permissions etc?
[ Parent
| on HN ]
Re:MobX 6
by shermanmccoy on Friday October 02, 2020 @02:57AM
(#24659753)
This is not a religious stand against all global state. Username, permissions fine to be global, this is very easy for someone new to your code to grok. I put them in the top React context, then just useReducer where I need to. Don't need to pass down through props to every component anymore, thanks to React context and useReducer.
Although I was thinking if you wanted to be a religious zealot about not coding any of your own global state you could use the browser session API.