Im trying to import plotly into my react app. Ive installed plotly with:
npm install plotly --save
Ive then tried importing in these different ways:
import * as Plotly from 'plotly'
import Ploty from 'plotly'
var Plotly = require('plotly')
Then I tried using plotly like this:
Plotly.newPlot('myDiv', data)
But every import gives me this error:
Uncaught TypeError: Plotly.newPlot is not a function
Im really lost and cannot find the right way to import plotly or any other third party library. Every guide, article I followed says I should import like Ive already tried.
Base on their Gitub page, you need to install plotly.js and not potly. npm install plotly.js
. After be sure to have a module loader correctly configurated to load it. Then you will be able to do import Potly from 'plotly.js';