Last active
July 19, 2019 19:57
-
-
Save mvbattan/26dddd6610673766e22524fbe3dbce35 to your computer and use it in GitHub Desktop.
createReducer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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