Hacker News new | past | comments | ask | show | jobs | submit login
I didn't “get” Redux, so I rewrote it, and this is what I learned (medium.com/davedrew)
5 points by dclowd9901 on June 9, 2016 | hide | past | favorite | 2 comments



Redux is a cool idea but what is it doing in my browser?

Javascript in browser is a single threaded environment. Immutability of data is a great concept in a context of concurrency but is an anti-pattern in browser code.

Create a global variable to store your entire global state of your application. g = {};

Use an observer pattern and create an event bus for all application entities to talk to each other. You get a simple alternative to Redux pattern.

Redux is a cool name though. Like an intern who works here said, its great to have on your resume but he does not know why its useful or what problem it solves.


Hm, that's an interesting question. The value I find in the immutability aspect comes from, I think, everything else that comes with it. In being immutable, an action taken has to be explicit, and therefore is trackable and replayable. So while you don't necessarily get much in the way of safety against concurrency (though, let's be honest: there is still asynchronicity in JS even without concurrency), you get a lot of free in terms of state tracking, state replication and state reproduction. This doesn't even mention the benefits around testing and reasoning about pure functions that are reducers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: