-
-
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
Can we add store to third parameter to reducer #1844
Comments
The top-level reducer function that you pass to Please read the related FAQ question: http://redux.js.org/docs/FAQ.html#reducers-share-state . Also, I am currently working on a new section for the Redux docs that describes best practices and approaches for writing reducer logic. The description is over in #1784 , and that issue has a link to my work-in-progress. |
@samuelpaulc Have a look at reselect which allows cross-cutting reducers: https://github.com/reactjs/reselect |
@marvinhagemeister we do use both combine reducers and reselect. The point is reselect selectors require the state to be passed which maybe levels higher than which is passed to the reducer. |
@marvinhagemeister , @samuelpaulc : hmm. selectors aren't usually a normal part of reducer logic - they're usually used on the UI/business-logic side of things, in your |
Discussion:
Can we add store to third parameter to reducer?
While working on our application, we ran into cases where a reducer may need to access some parts of state tree which are not directly related to it
We realize that this is indication that our store structure is not in line with redux philosophies but I feel the ability to design store based on functionality is kind of lost.
If this state was given to the reducer we can design the store based on application functionality.
Right now we are in a situation where we need to make the reducer as a top level reducer even when by functionality it should not, only that it needs to access common global state
Please suggest
I saw a similar question but that was for adding it to the mapStateToProps
The text was updated successfully, but these errors were encountered: