Last active
February 29, 2016 16:36
-
-
Save samsch/9275c6e4f9147ec27b07 to your computer and use it in GitHub Desktop.
Basic React rendering by listener.
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
//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