Skip to content

Instantly share code, notes, and snippets.

@aykutyaman
Created November 20, 2018 13:14
Show Gist options
  • Save aykutyaman/cfcd30a0d755cd14632d57a1d910a1a0 to your computer and use it in GitHub Desktop.
Save aykutyaman/cfcd30a0d755cd14632d57a1d910a1a0 to your computer and use it in GitHub Desktop.
redux combineReducer function
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