Home › forums › Chart Support › Cannot import to React
Tagged: cannot import
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.
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.
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.
You must be logged in to reply to this topic.