Skip to content

Instantly share code, notes, and snippets.

@nelix
Created February 18, 2015 08:58
Show Gist options
  • Save nelix/85d5695cfeae8dfd837b to your computer and use it in GitHub Desktop.
Save nelix/85d5695cfeae8dfd837b to your computer and use it in GitHub Desktop.
router.run((Handler, state) => {
log('route change', state);
function getData() {
var data = {};
_each(ALL_STORES, (store) => {
data[store + 'Data'] = flux.store(store).getState();
});
return data;
};
function render(data) {
React.render(<Handler {...data} params={state.params} actions={flux.actions}/>, document.body);
}
_each(ALL_STORES, (store) => {
flux.store(store).on('change', () => {
render(getData());
});
});
render(getData());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment