4 ms·
What would the code look like to use this approach for Redux. Could Redux boilerplate be reduced?
by hguhghuff 9y ago
What would the code look like to use this approach for Redux.
Could Redux boilerplate be reduced?
- acemarke 9y agoHi, I'm a Redux maintainer. First, could you clarify what _you_ mean by "Redux boilerplate" in this case? The phrase gets thrown around frequently, but it means different things to different people. Just yesterday, I tweeted some thoughts on how you can use as much abstraction as you want with Redux, and linked to examples of reusable action creator/reducer logic [0]. I also wrote a pair of blog posts that discuss the intent behind Redux's design [1], and why common usage patterns exist [2]. It's worth noting that React-Redux was originally written using a "render props"-type approach, but was changed to be a Higher-Order Component before it hit 1.0. In fact, there was a thread a month ago that discussed render props-based reimplementations of `connect` [3], and in that thread I linked to several recent examples of people reinventing that wheel as well as prior discussion of why React-Redux wound up as a HOC. Finally, earlier this year I opened up an issue to discuss ways that we can improve both the "getting started" experience for Redux users, as well as build more powerful abstractions on top of Redux [4]. I'd love more feedback and ideas (and ideally people from the community volunteering to help us make things better). [0] https://twitter.com/acemarke/status/928453589739155456 https://twitter.com/acemarke/status/928453589739155456 [1] http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-1/ http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao... [2] http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/ http://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao... [3] https://news.ycombinator.com/item?id=15427954 https://news.ycombinator.com/item?id=15427954 [4] https://github.com/reactjs/redux/issues/2295 https://github.com/reactjs/redux/issues/2295
- hguhghuff 9y agoI love Redux. I just want it to take less code to use.
- acemarke 9y agoHave you looked at any of the existing libraries in the ecosystem? There's dozens of tools for generating reusable functions like action creators and reducers [0], managing complex collections [1], and even higher-level abstractions on top of Redux like Kea [2]. Ultimately, you can put as much or as little abstraction on top of Redux as you want. [0] https://github.com/markerikson/redux-ecosystem-links/blob/master/action-reducer-generators.md https://github.com/markerikson/redux-ecosystem-links/blob/ma... [1] https://github.com/markerikson/redux-ecosystem-links/blob/master/entity-collection-management.md https://github.com/markerikson/redux-ecosystem-links/blob/ma... [2] https://kea.js.org/ https://kea.js.org/