[Chartjs]-Word cloud/tag chartJS TSX Expanding/moving

1👍

I’ve had problems of weird behavior when using document.getElementById in react components with chartjs before. I’ve solved some issues with refs, so it may be worth a shot?

So, initialize with

const canvasRef = useRef<HTMLCanvasElement|null>(null)

Add to canvas with:

<canvas className='max-h-10 max-w-10' ref={canvasRef}></canvas>

And call it with:

let canvas = canvasRef?.current

Leave a comment