Skip to content

Instantly share code, notes, and snippets.

@denisraslov
Last active January 7, 2018 16:55
Show Gist options
  • Save denisraslov/a3e14f190400b5c414b90cd26c660a84 to your computer and use it in GitHub Desktop.
Save denisraslov/a3e14f190400b5c414b90cd26c660a84 to your computer and use it in GitHub Desktop.
import React from 'react';
import DashboardView from 'views/dashboard';
class DashboardPage extends React.PureComponent {
// render an empty DIV and save a reference to it
render() {
return <div ref={node => this.node = node}></div>;
}
componentDidMount() {
// render a Backbone view into the referenced DIV
this.dashboardView = new DashboardView(this.node, this.props);
this.dashboardView.render();
}
componentWillUnmount() {
// don't forget to clean up after Backbone
this.dashboardView.remove();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment