Skip to content

Instantly share code, notes, and snippets.

@eeue56
Forked from scottcorgan/combine-reducers.js
Created April 14, 2016 18:24
Show Gist options
  • Select an option

  • Save eeue56/fbd608b650b34e735b2ebf87d8476970 to your computer and use it in GitHub Desktop.

Select an option

Save eeue56/fbd608b650b34e735b2ebf87d8476970 to your computer and use it in GitHub Desktop.
let initialState = {
one: 'two',
three: 'four'
}
function update1 (state = initialState, action) {
switch (action.type) {
case SOMETHING: {
return state.one = 'changed'
}
default: {
return state;
}
}
}
function update2 (state, action) {
// etc.
}
let rootUpdate = combineReducers({
update1: update1, // update1.one and update1.three
update2: update2
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment