Skip to content

Instantly share code, notes, and snippets.

@yelouafi
Created July 31, 2015 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yelouafi/513933c63e06e91785ab to your computer and use it in GitHub Desktop.
Save yelouafi/513933c63e06e91785ab to your computer and use it in GitHub Desktop.
function update(model, action) {
return action.type === RESET ?
{
first : counter.init(),
second: counter.init()
}
: action.type === UPDATE_FIRST ?
{...model, first : counter.update(model.first, action.data) }
: action.type === UPDATE_SECOND ?
{...model, second : counter.update(model.second, action.data) }
: model;
}
export default { view, init, update, actions : { UPDATE_FIRST, UPDATE_SECOND, RESET } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment