Ask HN: How do you manage state in your React application?
41–47 of 47 posts
Re: Ask HN: How do you manage state in your React application?
#42Re: Ask HN: How do you manage state in your React application?
#43Re: Ask HN: How do you manage state in your React application?
#44Pass the things returned from useReducer() hook (state object + dispatch function) down via context. Then useContext() in child components.
Re: Ask HN: How do you manage state in your React application?
#45Re: Ask HN: How do you manage state in your React application?
#46We use Redux at work for larger projects, React setState/Context for smaller ones, and I'm personally a huge fan of mobx-state-tree which I think is the best solution, and can be plugged into Redux if needed. I think Redux should not be used for everything (there are libraries like Redux-Form which I think are an anti-pattern as ephemeral state like that should never go through the root reducer on every key change)
I hate redux-form so. much.
Re: Ask HN: How do you manage state in your React application?
#47Been using MobX for about three years and I think it is wonderful. Incredibly easy to use (mark your variable as observable, modify it like you would any normal variable, and any components which use those variables in their rendering and are marked as observers automatically update), very performant out of the box (only components affected by a change re-render so no shouldComponentUpdate needed) and some excellent…
https://github.com/Nezaboodka/reactronic#readme
It is transactionally reactive state management library for JavaScript. Key difference from MobX/MST is that Reactronic doesn't enforce developers to stick with MST rules of building the structure of state - the state can be a set (graph) of usual JS objects.
Also, Reactronic has minimal set of concepts, just three: State, Transaction, and Cache. So, it is easier to use.
Drawback is that it's a new thing and is not yet battle tested.