Skip to content

Instantly share code, notes, and snippets.

@vcanales
Created February 15, 2016 14:48
Show Gist options
  • Save vcanales/9d568b1412f9c0083067 to your computer and use it in GitHub Desktop.
Save vcanales/9d568b1412f9c0083067 to your computer and use it in GitHub Desktop.
Component Lifecycle Problems
componentDidMount() {
this.setState(this.initialize());
return CatedralStore.addChangeListener(() => this._onCatedralChange());
}
componentWillUnmount() {
console.log("remove change listener")
return CatedralStore.removeChangeListener(this._onCatedralChange);
}
_onCatedralChange() {
console.log("catedral change event cb")
return this.setState(this.initialize());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment