Answer the question
In order to leave comments, you need to log in
How to generate dependent reducers in redux?
Hello, tell me what is the right way to draw the following scheme.
There are two components:
<toolbar />
<content />
<input>
. <toolbar/>
- the component should react <content/>
and vice versa. store = {
app: {
activePage: 1,
toolbar: {
...., // некие параметры, относящиеся только к тулбару
// нужно ли дублировать activePage здесь?
},
content: {
...,
}
}
}
case type.SET_ACTIVE_PAGE:
return {
...state,
activePage: action.activePage,
toolbar: toolbarReducer(state.toolbar, action),
content: contentReducer(state.content, action)
};
break;
Answer the question
In order to leave comments, you need to log in
So what's the problem? You map values from store using mapStateToProps (react-redux package).
Create a reducer for the active page and that's it.
The shape of the state is up to you: it can be a primitive , an array, an object, or even an Immutable.js data structure
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question