Skip to content

Instantly share code, notes, and snippets.

@dbeattie71
Created April 8, 2017 18:36
Show Gist options
  • Save dbeattie71/5a0f5be80faa21cb31b173ae78c9127b to your computer and use it in GitHub Desktop.
Save dbeattie71/5a0f5be80faa21cb31b173ae78c9127b to your computer and use it in GitHub Desktop.
export default function createReducer(initialState, handlers) {
return function reducer(state = initialState, action) {
if (handlers.hasOwnProperty(action.type)) {
return handlers[action.type](state, action)
} else {
return state
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment