10 lines
253 B
JavaScript
10 lines
253 B
JavaScript
export function createReducer(initialState, reducerMap) {
|
|
return (state = initialState, action) => {
|
|
const reducer = reducerMap[action.type];
|
|
|
|
return reducer
|
|
? reducer(state, action.payload)
|
|
: state;
|
|
};
|
|
}
|