Skip to content

Instantly share code, notes, and snippets.

@VadimBrodsky
Last active November 30, 2017 03:22
Show Gist options
  • Save VadimBrodsky/7420d9502c023b94ac92d6f5687f0b55 to your computer and use it in GitHub Desktop.
Save VadimBrodsky/7420d9502c023b94ac92d6f5687f0b55 to your computer and use it in GitHub Desktop.
Redux
const combineReducers = (reducers) => {
return (state = {}, action) => {
return Object.keys(reducers).reduce((nextState, key) => {
nextState[key] = reducers[key](state[key], action);
return nextState;
}, {});
};
};
const todoApp = combineReducers({
todos,
visibilityFileter,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment