Skip to content

Instantly share code, notes, and snippets.

@richarddprasad
Last active March 26, 2020 18: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/cbe572223e46d6cb7e8110ffdcc3ee27 to your computer and use it in GitHub Desktop.
Save richarddprasad/cbe572223e46d6cb7e8110ffdcc3ee27 to your computer and use it in GitHub Desktop.
React.useEffect(() => {
let mouseDown: boolean = false;
...
return function cleanup() {
if (canvasRef.current) {
canvasRef.current.removeEventListener('mousedown', handleMouseDown);
canvasRef.current.removeEventListener('mouseup', handleMouseUp);
canvasRef.current.removeEventListener('mousemove', handleMouseMove);
}
}
}, [context]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment