Home Forums Chart Support Cannot import to React

Cannot import to React

Viewing 4 posts - 1 through 4 (of 4 total)
  • #27248


    I’m trying to create a React app and I followed the instructions posted. But I keep getting this error:
    Attempted import error: ‘CanvasJS’ is not exported from ‘./canvasjs.react’ (imported as ‘CanvasJSReact’).

    what am i doing wrong?



    Please take a look at this sample project for integrating CanvasJS with React. You can also checkout our React Gallery for more examples.

    Basic Column Chart in React

    If you are still facing the issue, kindly share a sample project reproducing the issue over google-drive or one-drive so that we can look into the code, understand the scenario better and help you out.

    Manoj Mohan
    Team CanvasJS


    Hi Guys,

    Yes, meg_lai is correct. Your demos are not working.

    The code below is now the correct way to import.

    import CanvasJSReact from '../../assets/canvasjs.react.js';
    var CanvasJSChart = CanvasJSReact.CanvasJSChart;


    The download sample seems to be working fine. Providing proper relative path for canvasjs.react.js file should work fine in your case.

    Manoj Mohan
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.