Skip to content

Instantly share code, notes, and snippets.

@dbani-dev
Last active July 12, 2017 03:36
Show Gist options
  • Save dbani-dev/f25485ff943c5d377a7a1777448f7111 to your computer and use it in GitHub Desktop.
Save dbani-dev/f25485ff943c5d377a7a1777448f7111 to your computer and use it in GitHub Desktop.
const initialState = Immutable.fromJS({
status: null,
error: null,
items: Immutable.List([]),
nested: {
test: 'a',
groups: {
users: []
}
}
})
const updateState = initialState
.set('status', 'active')
.set('error', false)
.update('items', (list: any) => list.push('a', 'b', 'c'))
.update('items', (list: any) => list.delete(list.keyOf('b')))
.setIn(['nested', 'groups', 'users'], Immutable.List([1, 2, 3]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment