Last active
August 29, 2015 14:17
-
-
Save goatslacker/f031f4684205be40cea7 to your computer and use it in GitHub Desktop.
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
const Immutable = require('immutable'); | |
const Alt = require('alt'); | |
const alt = new Alt(); | |
const actions = alt.generateActions('fire'); | |
const store = alt.createStore({ | |
displayName: 'ImmutableStore', | |
bindListeners: { | |
onSomething: actions.fire | |
}, | |
state: Immutable.Map({}), | |
onSomething(x) { | |
// or this? this.setImmutableState('foo', x); | |
this.setState(this.state.set('foo', x)); | |
} | |
}); | |
store.getState().foo // undefined | |
actions.fire('hello world') | |
store.getState().foo // hello world |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment