I have a need to combine new reducer with the existing one, and the store hasn't configured with combineReducers yet, so this is the first it'll be configure.
Taking from the docs' example, I think this is how it'll be implemented:
import { combineReducers } from 'redux';
import existingReducers from './reducer';
import newReducer from './new-reducer';
const reducers = combineReducers({
existing: existingReducers,
newReducer
});
By that approach, now I need to add a new property in entire state which used the existing reducer. e.g
from state.user.email need to change into state.existing.user.email.
Is it possible to use combineReducers without adding a new level property?? I don't want to add a new reducer into the existing one anymore.
Existing State
{
user: { email: 'abc', ... },
foo: { ... },
bar: { ... },
}
If using the above approach, I'll get this state
{
existing: {
user: { email: 'abc', ...},
foo: { ... },
bar: { ... }
},
newReducer: { ... }
}
Expected State when using combineReducers
{
user: { email: 'abc', ... },
foo: { ... },
bar: { ... },
newReducer: { ... }
}