Skip to content

Instantly share code, notes, and snippets.

@AllThingsSmitty
Created June 19, 2015 12:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllThingsSmitty/e78936c35bccb4378c20 to your computer and use it in GitHub Desktop.
Save AllThingsSmitty/e78936c35bccb4378c20 to your computer and use it in GitHub Desktop.
Great way to wrap non-React UI elements that manage lists of items and leverage VDOM diffing
const SourceElement = React.createClass({
componentDidMount: f() {
this.props.view.addSource(this.props.source);
},
componentWillUnumount: f() {
this.props.view.removeSource(this.props.source);
},
componentWillReceiveProps: f(nextProps) {
this.props.view.updateSource(nextProps.this.props.source);
},
render: f() {
return null;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment