Skip to content

Instantly share code, notes, and snippets.

@skellock
Created June 27, 2016 12:54
Show Gist options
  • Save skellock/d12dcc21b253cdc11f7c9ad9d72622d4 to your computer and use it in GitHub Desktop.
Save skellock/d12dcc21b253cdc11f7c9ad9d72622d4 to your computer and use it in GitHub Desktop.
const INITIAL_STATE = { value: 0 }
// do something important & significant
const increment = (state, action) => ({ value: state.value + 1 })
// our reducer
export default (state = INITIAL_STATE, action) => {
switch (action.type) {
case 'INCREMENT': return increment(state, action)
default: return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment