Skip to content

Instantly share code, notes, and snippets.

@matt-mcdaniel
Last active April 22, 2016 18:57
Show Gist options
  • Save matt-mcdaniel/46cd51e30be3f21b124b10cf39344df2 to your computer and use it in GitHub Desktop.
Save matt-mcdaniel/46cd51e30be3f21b124b10cf39344df2 to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
class D3ComponentExample extends React.Component {
constructor(){
super();
this.update = this.update.bind(this);
}
render(){
return (
<svg>
<g ref="group"></g>
</svg>
)
}
componentDidMount(){
this.update();
}
componentDidUpdate(){
this.update();
}
update(){
const el = d3.select(this.refs.group);
// perform initial d3 operations here
}
}
export default D3ComponentExample;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment