You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
398 B
21 lines
398 B
function createReducers(sections, createReducer) {
|
|
const reducers = {};
|
|
|
|
sections.forEach((section) => {
|
|
reducers[section] = createReducer(section);
|
|
});
|
|
|
|
return (state, action) => {
|
|
const section = action.payload.section;
|
|
const reducer = reducers[section];
|
|
|
|
if (reducer) {
|
|
return reducer(state, action);
|
|
}
|
|
|
|
return state;
|
|
};
|
|
}
|
|
|
|
export default createReducers;
|