Skip to content

Instantly share code, notes, and snippets.

@mynameisflorian
Last active May 4, 2020 14:58
Show Gist options
  • Save mynameisflorian/3ae89d71a73aa05f71a9547967ea045a to your computer and use it in GitHub Desktop.
Save mynameisflorian/3ae89d71a73aa05f71a9547967ea045a to your computer and use it in GitHub Desktop.
Immutable State-List Idea
<script src="https://gist.github.com/mynameisflorian/3ae89d71a73aa05f71a9547967ea045a.js"></script>
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