Create a gist now

Instantly share code, notes, and snippets.

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