Home Forums Chart Support React example setup error

React example setup error

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

    I tried setting up the example from the page https://canvasjs.com/docs/charts/integration/react/
    I have my canvasjs.min.js and canvasjs.react.js in my /src/ folder and getting the following error:

    TypeError: Cannot assign to read only property ‘exports’ of object ‘#<Object>’
    39 | }
    40 | }
    41 |
    > 42 | module.exports = {
    43 | CanvasJSChart: CanvasJSChart,
    44 | CanvasJS: CanvasJS
    45 | };

    Any possible solutions?
    Thank you



    Can you please share a sample project over google-drive or one-drive reproducing the issue you are facing, so that we can look into your code, understand the scenario better and help you out?

    Priyanka M S
    Team CanvasJS


    Here is my App.js in the src/

    I also have the canvasjs.react.js and canvasjs.min.js in the src/ folder



    The code that you have shared seems to be working fine. Kindly cross-check the path of the script that you have specified in your app.
    1. Save canvasjs.react.js and canvasjs.min.js within source-folder of your React application (src or src/assets or src/lib)
    2. Import canvasjs.react.js to your app. (Please specify proper path of script if you have saved it in different folder like src or src/assets or src/lib)
    import CanvasJSReact from './canvasjs.react';

    Please take a look at this sample project for an working example with proper path.
    React Column Chart

    Priyanka M S
    Team CanvasJS

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

You must be logged in to reply to this topic.