Skip to content

Instantly share code, notes, and snippets.

@yelouafi
Last active August 29, 2015 14:25
Show Gist options
  • Save yelouafi/1a20e354bd5a1fae827b to your computer and use it in GitHub Desktop.
Save yelouafi/1a20e354bd5a1fae827b to your computer and use it in GitHub Desktop.
const resetAction = {type: counter.actions.INIT, data: 0};
function update(model, action) {
return action.type === ADD ? addCounter(model)
: action.type === RESET ? resetCounters(model)
: action.type === REMOVE ? removeCounter(model, action.id)
: action.type === UPDATE ? updateCounter(model, action.id, action.data)
: model;
}
export default { view, update, actions : { ADD, RESET, REMOVE, UPDATE } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment