A tiny react hook for rendering canvas.
yarn add @kirkegaard/react-use-canvas
or
npm i @kirkegaard/react-use-canvas
Check the example folder
function Example() {
const setup = ({ context, height, width }) => {};
const draw = ({ context, time, height, width }) => {};
const { ref } = useCanvas({ setup, draw });
return <canvas ref={ref} />;
}