Chartjs-React-chartjs-2: Canvas is already in use. Chart with ID '0' must be destroyed before the canvas with ID '' can be reused

0👍

The tutorial method that I have tried must be outdated so I visited chart.js template from new issue page react-chartjs-2 sandbox (React)

I used this method instead of the code I have provided in this post:

Imports

import { Chart, registerables } from 'chart.js';
import { Chart as ReactChartJs } from 'react-chartjs-2';

Chart

<ReactChartJs type="pie" data={processedChartData} />

View Output

Leave a comment