Skip to content

Instantly share code, notes, and snippets.

@mvbattan
Last active July 19, 2019 19:57
Show Gist options
  • Save mvbattan/26dddd6610673766e22524fbe3dbce35 to your computer and use it in GitHub Desktop.
Save mvbattan/26dddd6610673766e22524fbe3dbce35 to your computer and use it in GitHub Desktop.
createReducer
function createReducer(initialState, reducerObject) {
return (state = initialState, action) => (
(reducerObject[action.type] && reducerObject[action.type](state, action)) || state;
);
}
export default createReducer(initialState, reducerDescription);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment