Skip to content

Instantly share code, notes, and snippets.

@kiraind
Created July 22, 2019 06:49
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 kiraind/3661f38125eb6e4ef8f50ba475e925c3 to your computer and use it in GitHub Desktop.
Save kiraind/3661f38125eb6e4ef8f50ba475e925c3 to your computer and use it in GitHub Desktop.
Immutable state mutation patterns
setState({
...state,
array: [
...state.array.slice(0, i),
newArrayI,
...state.array.slice(i + 1),
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment