Created
April 6, 2016 02:08
-
-
Save Nicktho/cf1ac2bc79735e218126a05f1dc8e8c5 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
export function combineReducers(reducers) { | |
return (oldState, action) => { | |
return Object.keys(reducers).reduce((newState, key) => { | |
const reducer = reducers[key]; | |
newState[key] = reducer(oldState[key], action); | |
return newState; | |
}, {}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment