Skip to content

Instantly share code, notes, and snippets.

@cpv123
Created January 4, 2020 08:39
Show Gist options
  • Save cpv123/5cd0054a5460ab56ff67a7ccb938cc4f to your computer and use it in GitHub Desktop.
Save cpv123/5cd0054a5460ab56ff67a7ccb938cc4f to your computer and use it in GitHub Desktop.
const initialState = {
todos: {
'a': { id: 'a', description: '...', isComplete: false },
'b': { id" 'b', description: '...', isComplete: false }
}
}
const reducer = (state, action) => ({
...state,
todos: {
...state.todos,
[action.todoId]: {
...state.todos[action.todoId],
isComplete: action.payload,
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment