listenTo
Expects either a store Id or an array of store Ids. Just before the initial render, it will register a change listener with the specified store(s).
When the element is about to be unmounted from the DOM it will dispose of an change listeners.
var UserState = Marty.createStateMixin({
listenTo: ['userStore', 'fooStore']
});getState
The result of getState will be set as the state of the bound component. getState will be called when
getInitialStateis called- The components props change
- Any of the stores change
var UserState = Marty.createStateMixin({
getState: function () {
return {
user: this.app.userStore.getUser(this.props.id)
}
}
});app
Returns the instance's application.