Change const data = (canvas: { getContext: (arg0: string) => any; })
to
const data = (canvas: HTMLCanvasElement) => {}
And in the return do
<Line options={options} data={data(canvasRef)} />
You will have to pass the ref
of your canvas
element to the data
function
CLICK HERE to find out more related problems solutions.