Skip to content

Instantly share code, notes, and snippets.

@christiannaths
Last active February 13, 2017 23:59
Show Gist options
  • Select an option

  • Save christiannaths/fa67ac87fecae6dd20a02d35347cc433 to your computer and use it in GitHub Desktop.

Select an option

Save christiannaths/fa67ac87fecae6dd20a02d35347cc433 to your computer and use it in GitHub Desktop.
my-app/src/store/reducers.js
import { TYPES } from './actions'
const initialStates = {
settings: {
notifications: true
}
}
export const settings = (state = initialStates.settings, action) => {
switch (action.type) {
case TYPES.SET_NOTIFICATIONS:
return Object.assign({}, state, { notifications: action.bool })
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment