Last active
May 4, 2020 14:58
-
-
Save mynameisflorian/3ae89d71a73aa05f71a9547967ea045a to your computer and use it in GitHub Desktop.
Immutable State-List Idea
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
<script src="https://gist.github.com/mynameisflorian/3ae89d71a73aa05f71a9547967ea045a.js"></script> |
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
function createStateObject( propertiesObject, lastStateObject = null ){ | |
return Object.freeze( | |
Object.create( | |
lastStateObject, | |
Object.getOwnPropertyDescriptors( propertiesObject ) | |
) | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment