Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

possible addition: composeReducers(...reducers) #71

Open
warren-bank opened this issue Jan 31, 2018 · 2 comments
Open

possible addition: composeReducers(...reducers) #71

warren-bank opened this issue Jan 31, 2018 · 2 comments

Comments

@warren-bank
Copy link

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.

@markerikson
Copy link
Owner

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

@warren-bank
Copy link
Author

warren-bank commented Jan 31, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants