Skip to content

Instantly share code, notes, and snippets.

@samsch
Last active February 29, 2016 16:36
Show Gist options
  • Save samsch/9275c6e4f9147ec27b07 to your computer and use it in GitHub Desktop.
Save samsch/9275c6e4f9147ec27b07 to your computer and use it in GitHub Desktop.
Basic React rendering by listener.
//Some store thing that has onUpdate as a method for setting listeners.
store.onUpdate(function(newState) {
ReactDOM.render(
<App state={newState} />,
document.getElementById("root")
);
});
//You either need to call render once here to get things started, or cause a state update.
ReactDOM.render(
<App state={store.getState()} />,
document.getElementById("root")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment