-
-
Save rbiggs/760e5ddb3f01021b999deb31c3e1ebc4 to your computer and use it in GitHub Desktop.
Clone state for actions for immutability
This file contains hidden or 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
| udate(state, message) { | |
| // Create clone of state with destructing: | |
| const prevState = {...state} | |
| // Pass cloned state to actions: | |
| return actions(prevState, message) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment