Last active
April 22, 2016 18:57
-
-
Save matt-mcdaniel/46cd51e30be3f21b124b10cf39344df2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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