Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Created April 22, 2015 05:05
Show Gist options
  • Select an option

  • Save AndrewRayCode/9607cbb473c30f1421c2 to your computer and use it in GitHub Desktop.

Select an option

Save AndrewRayCode/9607cbb473c30f1421c2 to your computer and use it in GitHub Desktop.
componentDidMount: function() {
UserStore.on( 'change', this.onStoreChange );
},
componentWillUnmount: function() {
UserStore.off( 'change', this.onStoreChange );
},
onStoreChange: function() {
// this is called when unmounted. this.isMounted() === false
this.setState( this.getState() );
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment