Looking forward to your views
Ask HN: How do you manage state in your React application?
1–10 of 47 posts
Re: Ask HN: How do you manage state in your React application?
#2Re: Ask HN: How do you manage state in your React application?
#3Redux is fine but I guess with the new hooks functionality one can combine usereducer and contexts to create a much simpler state manager.
Re: Ask HN: How do you manage state in your React application?
#4I 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)
Re: Ask HN: How do you manage state in your React application?
#5Compared to redux it's far more simple and requires none of the boilerplate. It also allows perfect type support with typescript.
Re: Ask HN: How do you manage state in your React application?
#6Re: Ask HN: How do you manage state in your React application?
#7Re: Ask HN: How do you manage state in your React application?
#8Learning Redux, especially the "single source of truth" thing was very helpful, but my code is now simpler, easier to understand and faster to write.
I would recommend checking out React context and hooks. I would also recommend watching the Redux videos by Dan Abramov, even if you don't use Redux.
Re: Ask HN: How do you manage state in your React application?
#9https://github.com/facebook/flux
from facebook if you app has a lot of global state needs multiple stores can be handy.
Mobx is great too:
https://github.com/mobxjs/mobx
With the current project I am working on we actually just vanilla javascript with singeltons with subscriptions (note: I did not write this, but I think it is rxjs).
anyways someone should come along with some answers.
Redux is still the easiest and with Sagas is really cool. One start up I interviewed with was using something similar to hooks, but do not remember the name of it.
Also datomic (used by om.next in clojurescript) has some really clever optimizations and is a joy to use.
Re: Ask HN: How do you manage state in your React application?
#10I started out with Redux and I do think it’s worth learning - not just because it’s so widespread, but the concepts behind it are worth knowing and have influenced the way I design some stuff, but I found it really verbose and slow to work with compared to MobX (and more error prone) - there probably are libraries that help with this.
React Hooks look interesting for more simple use cases but I expect I’ll stick with MobX for the foreseeable future.