Skip to content

Instantly share code, notes, and snippets.

@moretti
Created August 25, 2016 17:39
Show Gist options
  • Save moretti/fd992ddd714c34a70debca0ce70a8adb to your computer and use it in GitHub Desktop.
Save moretti/fd992ddd714c34a70debca0ce70a8adb to your computer and use it in GitHub Desktop.
class CanvasComponent extends React.Component {
componentDidMount() {
this.updateCanvas();
}
updateCanvas() {
const ctx = this.refs.canvas.getContext('2d');
ctx.fillRect(0,0, 100, 100);
}
render() {
return (
<canvas ref="canvas" width={300} height={300}/>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment