Returns the immutable state object from the store
fluxapp.registerStore('search', {
actions: {
onSearchResults: 'search.search',
},
onSearchResults: function(results) {
this.replaceState(results);
},
getFilteredResults: function(filter) {
var state = this.getState();
return state.results.filter(filter);
}
});
fluxApp.registerActions('search', {
search : function search(criteria) {
var criteriaStore = this.getStore('searchCriteria').getState();
return performSearch(criteria);
}
});
module.exports = React.createClass({
displayName : 'SearchBar',
mixins : [ fluxApp.mixins.component ],
render : function renderSearchBar() {
var results = this.getStore('search').getState();
var term = results.term;
return (
<input defaultValue={term} />
);
}
});
On to getMutableState()