-
-
Save Emilios1995/d9a1bbf6c68381cd4ba017ceb6f4421b to your computer and use it in GitHub Desktop.
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
const createReducer = (initialState, map) => | |
(state = initialState, action) => | |
(map[action.type]) | |
? map[action.type](state) | |
: state | |
const reducer = createReducer(0, counterMap) | |
reducer(0, {type: "increment"}) // => 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment