我试着在codesandbox中做到这一点: const Chart = require("chart.js"); this.chart = new Chart(this.chartRef.current和那个Chart is not a constructor 我还尝试将其替换为 import Chart from chart.js 但这也不起作用。我怎样才能修复我的codesandbox?
我熟悉使用export default ExampleFunc,以便可以将ExampleFunc作为import Func from 'filename.js'导入到不同的文件中。但是,我遇到过export default的一种用法,它将对象导出到同一文件中的一个类。下面的代码是否实例化Container对象?import ExampleComp from 'file.js';