Chartjs-Trying to export chart with Chartjs and React but getting erorr

2👍

let input = window.document.getElementsByClassName("divToPDF"); actually gives you an array of HTML elements whereas html2canvas expect only one element.

Your problem is fixed with
let input = window.document.getElementsByClassName("divToPDF")[0];

Here a working codesandbox

Leave a comment