You must be logged in to post your query.
Home › Forums › Chart Support › Cannot import to React
Tagged: cannot import
Hi,
I’m trying to create a React app and I followed the instructions posted. But I keep getting this error: ./src/index.js Attempted import error: ‘CanvasJS’ is not exported from ‘./canvasjs.react’ (imported as ‘CanvasJSReact’).
what am i doing wrong?
@meg_lai,
Please take a look at this sample project for integrating CanvasJS with React. You can also checkout our React Gallery for more examples.
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;
@saulable,
The download sample seems to be working fine. Providing proper relative path for canvasjs.react.js file should work fine in your case.
canvasjs.react.js
—- Manoj Mohan Team CanvasJS
You must be logged in to reply to this topic. Login/Register