Hacker News new | ask | show | jobs
by chncdcksn 3029 days ago
(To preface, I use React/Redux in all of my web applications. I think Redux is great for managing state.)

One thing I’ve never quite understood about Redux is why we are dispatching pure data instead of a function of state. This would remove the need for reducers, since your action _is_ your reducer. Something like this...

https://gist.github.com/anonymous/a5d741c5dec81be61e0aa70820...

Would this come with any drawbacks? I could see a large application having performance issues because of a large number of function allocations, but for small applications I don’t see a downside, just a simpler API.

1 comments

Now what you have is a global mutable state store instead of an "immutable" state store, as everywhere can change anything and tracking down what code does what is back to being nightmarish.