Created
November 20, 2018 13:14
-
-
Save aykutyaman/cfcd30a0d755cd14632d57a1d910a1a0 to your computer and use it in GitHub Desktop.
redux combineReducer function
This file contains hidden or 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 combineReducers = reducers => (state = {}, action) => | |
Object.keys(reducers).reduce((acc, key) => ({ | |
...acc, | |
[key]: reducers[key](state[key], action) | |
}), {}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment