Skip to content

Instantly share code, notes, and snippets.

@chiefGui
Last active March 8, 2017 15:24
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 chiefGui/a7a0e6c923080440df7330fc5d9f13bf to your computer and use it in GitHub Desktop.
Save chiefGui/a7a0e6c923080440df7330fc5d9f13bf to your computer and use it in GitHub Desktop.
const todos = (state = INITIAL_STATE, action) => {
switch (action.type) {
case ADD_TODO:
return [...state.todos, action.todo]
case REMOVE_TODO:
return state.todos.filter(todo => todo.id !== action.todo.id)
default:
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment