Use Canvas Size
Often when using canvases it is important to know the dimensions of the actual box in the dom.
This hook will give you the dimensions when supplied with a ref to the canvas.
yarn add react-hooks-use-canvas-size
Here is an example of finding the size of the canvas.
import React useRef useEffect from 'react'import useCanvasSize from 'react-hooks-use-canvas-size'const BigOlSquare =const canvasRef =const width height =return <canvas = />