Created
July 22, 2019 06:49
-
-
Save kiraind/3661f38125eb6e4ef8f50ba475e925c3 to your computer and use it in GitHub Desktop.
Immutable state mutation patterns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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