possible addition: `composeReducers(...reducers)`
warren-bank opened this issue · 2 comments
Hi. Me again. I have another one for you :)
here is the repo.
here is the npm module.
In summary:
- This simply chains multiple reducers together (by functional composition) so the output of one is fed into the next.
- The resulting reducer function can (of course) be composed itself along with other reducers, if need be.
It's nothing too major, and finding a reason to use it would probably be uncommon..
I wrote it as a learning exercise, while re-reading a book on redux that I'm trying to fully grok.
From reading the description, that sounds like Andrew Clark's reduce-reducers
utility. I talked about how to use it in the Beyond combineReducers
docs page, and in my post Practical Redux, Part 7: Feature Reducers
Thanks! I did a quick search for other implementations, but didn't find this one..
He makes clever use of Array.reduce() to replace a for() loop..
but it still uses a loop to iterate through the reducers..
I was just experimenting with how to perform the same task with composition..
which is probably a bit more academic than practical :)
I'll update my README and include a link to his repo too..
thanks again.