-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
Let combineReducers pass full reducer signature #1913
Comments
I do think the number of times this issue keeps getting raised is an indicator that we should do something. But I'm not sure if that's a code change or a documentation change. I think part of it is that people (including myself initially) see |
I don't see it as the only way, but adhering to the reducer signature and passing the complete state will definitely help with a lot of cases where you have to use your custom |
Yes, which is one of the biggest reasons why I'm writing the "Structuring Reducers" pages.
I'm not sure what you mean by that. The signature of an I do certainly understand the desire to share data across slices, but there's multiple valid approaches to the issue that do not require changes to If anything actually is gonna happen with updating |
I know, I read all of your docs. Nonetheless the signature for Array.reduce() is |
Currently
combineReducers
applies the nested reducers with the following props:reducer(stateByKey, action)
If you need the full state in one of the nested stores, you can't access it, and you'll be forced to create a custom
combineReducers
.I suggest changing the signature (in a non-breaking way) to be fully compliant with the
reducer
signature:reducer(stateByKey, action, key, state)
- where the last property is the original state passed on tocombineReducers
.This way, if you need the full state (or a state from a nested sibling reducer) you will be able to access it. This is compliant with the way
lodash
applies the reducer function to collections, and the way Array applies the reducer function to each element.Also, it does not break things, but extends current functionality.
If approved I can add a PR for this.
The text was updated successfully, but these errors were encountered: