Hacker News new | ask | show | jobs
by acemarke 2722 days ago
Hi, I'm a Redux maintainer. Here's a few resources.

First, the docs already have a page called "Reducing Boilerplate", which shows patterns like writing a function that accepts a lookup table of reducers [0].

Second, a while back I wrote a pair of posts called "The Tao of Redux" [1] [2]. Part 1 discusses the implementation and intent behind how Redux is meant to be used, and Part 2 looks at why common usage practices exist. As part of that, I pointed out that you can use whatever logic you want in your reducers, and as much or as little abstraction on top of Redux. Switch statements are simply the most obvious way to handle multiple values for a single field, but you should feel free to use whatever approach you want.

Third, we've recently created a new package called `redux-starter-kit` [3]. It helps simplify several common use cases, including store setup, defining reducers, immutable update logic, and even creating entire "slices" of state at once without writing any action types or action creators by hand. I'd encourage you to try it out and let us know how well it works for you.

Please let me know if you've got any other questions I can help with!

[0] https://redux.js.org/recipes/reducing-boilerplate

[1] https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-ta...

[2] https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-ta...

[3] https://redux-starter-kit.js.org/

1 comments

This is great, thanks so much