I wanna pass a value from redux state from reducer to another reducer. In my case i want to pass the value of groups from state in groupReducer.js to scheduleReducer.js. I'm using combineReducers from redux to combine between them.
Here's my code:
groupReducer.js
...
const initialState = {
groups: [],
...
export default function(state = initialState, action) {
switch (action.type) {
case FETCH_GROUPS:
return {
...state,
groups: action.payload
};
...
scheduleReducer.js
const initialState = {
...
}
...
export default function(state = initialState, action) {
switch (action.type) {
case GROUP_INFO:
return {
group: groupInfo(action.payload.id, SHOULD_PASS_GROUPS_FETCHED_FROM_GROUPREDUCER)
};
I want to pass the groups to the last reducer, How can i do this?