Skip to content

Instantly share code, notes, and snippets.

@classiemilio
Last active February 14, 2017 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save classiemilio/7f3acf2f107c6baac94d56de1a21e5ef to your computer and use it in GitHub Desktop.
Save classiemilio/7f3acf2f107c6baac94d56de1a21e5ef to your computer and use it in GitHub Desktop.
const React = require(‘react’);
const ReactDOM = require(‘react-dom’);
class MyGraphComponent extends React.Component {
componentDidMount() {
/* D3 code to append elements to this.svg */
}
shouldComponentUpdate() {
return false; // This prevents future re-renders of this component
}
render() {
return (
<svg ref={(elem) => { this.svg = elem; }} />
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment