Created
April 24, 2017 14:28
-
-
Save mushfiqweb/6022c71826983253e45e74bc8e69b3fc 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
var state = freezer.get(); | |
// this will replace app state for a new one | |
state.todos.push({ | |
model: {id: 1, title: 'Do this.', completed: false}, | |
ui: {status: 'ready', input: 'Do this.'} | |
}); | |
// state variable is still unchanged, | |
// it is immutable | |
console.log( state.todos ); // [] | |
// but the state has changed | |
state === freezer.get(); // false | |
// our data is in the new state | |
console.log( freezer.get().todos.length ); // 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment