3 ms·
Ask HN: State management with React
So, React looks pretty cool, and I have most of the other questions answered as far as building a client-side app with it.
What are people using to manage state with React these days? I see some people using Backbone, but Backbone's API feels really clunky and overly ceremonious to me. I'd love to hear what you guys are having success/difficulty with.
- zubairq 12y agoReact is pretty awesome. I made a demo of a time travelling debugger using React. Just play with the app then press debug at the top, and move the slider (The language is Clojurescript and uses David Nolen's Om by the way). http://connecttous.co/connecttous/connecttous.html?livedebug=true http://connecttous.co/connecttous/connecttous.html?livedebug... : Doing something like this without React would be almost impossible
- notduncansmith 12y agoThat's pretty sweet. I did notice that moving back in time (thus changing the values to what they had previously been) actually caused it to think more stuff had changed, therefore increasing the number of changes to track. Still, a relatively small bug in an incredibly cool demo. This doesn't exactly answer my question of what people are using to store data for React to use though. For instance, if I have an inbox and I want to display a list of messages, and unread counts for each folder. It makes sense to me to store that data in one place, instead of copying it to each component's state. So where does it go? Just a global POJO, or what?
- zubairq 12y agoHi, Glad you liked the demo, it is a GPL project at https://github.com/zubairq/coils https://github.com/zubairq/coils. I may have fixed the bug with going back in time, not 100% sure though, but maybe try it again as more fixes have gone in. Regarding how people are storing data for react, this is a big topic in itself. I personally (and with Coils) keep a UI only data structure which updates the React GUI, and then synchronise the state from a Data store totally independantly, although I have seen that other projects mix this up a bit, or don't give an opinion on it, which can caue misuse. Does that answer the question?