Last active
January 4, 2020 08:47
-
-
Save cpv123/12c943b17ae1595e0b126ff0e5b279d2 to your computer and use it in GitHub Desktop.
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
const immu = obj => deepFreeze(obj) | |
const createNewState = (currentState, updater) => { | |
const draftState = deepUnfreeze(currentState) | |
updater(draftState) | |
return immu(draftState) | |
} | |
export { immu, createNewState } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment