Created
August 25, 2016 17:39
-
-
Save moretti/fd992ddd714c34a70debca0ce70a8adb 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
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