Skip to content

Instantly share code, notes, and snippets.

@cpv123
Last active December 25, 2019 07:54
Show Gist options
  • Save cpv123/7114d3918dedcca5b6c46f513bb3e4a5 to your computer and use it in GitHub Desktop.
Save cpv123/7114d3918dedcca5b6c46f513bb3e4a5 to your computer and use it in GitHub Desktop.
// Immutable() when using seamless-immutable; Immutable.fromJS() when using ImmutableJS
const initialState = Immutable({
todos: {
'a': { id: 'a', description: '...', isComplete: false },
'b': { id: 'b', description: '...', isComplete: false }
}
})
const reducer = (state, action) => (
state.setIn(['todos', action.todoId, 'isComplete'], action.payload)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment