Skip to content

Instantly share code, notes, and snippets.

@richarddprasad
Created March 26, 2020 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richarddprasad/5a84aef1b9ba48e09a89d834efd79bb4 to your computer and use it in GitHub Desktop.
Save richarddprasad/5a84aef1b9ba48e09a89d834efd79bb4 to your computer and use it in GitHub Desktop.
React.useEffect(() => {
if (canvasRef.current) {
const renderCtx = canvasRef.current.getContext('2d');
if (renderCtx) {
setContext(renderCtx);
}
}
}, [context]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment