Reactjs 导入物料UI图标按钮时出现类型错误
我已经开始查看材质UI,但遇到了麻烦 我已经在我的应用程序中添加了一个Reactjs 导入物料UI图标按钮时出现类型错误,reactjs,typeerror,material-ui,Reactjs,Typeerror,Material Ui,我已经开始查看材质UI,但遇到了麻烦 我已经在我的应用程序中添加了一个Drawer,效果很好,但是当尝试添加IconButton时,我遇到了一个问题,似乎无法找到原因 我的程序运行正常,在我添加以下行后突然停止工作: import IconButton from '@material-ui/core/IconButton'; 所以有些东西在导入行失败了 错误是get是: index.js:60 TypeError: Super expression must either be null or
Drawer
,效果很好,但是当尝试添加IconButton
时,我遇到了一个问题,似乎无法找到原因
我的程序运行正常,在我添加以下行后突然停止工作:
import IconButton from '@material-ui/core/IconButton';
所以有些东西在导入行失败了
错误是get是:
index.js:60 TypeError: Super expression must either be null or a function
at _inherits (inherits.js:7)
at TouchRipple.js?bed4:131
at Object.<anonymous> (TouchRipple.js?bed4:348)
at Object.631 (0.442234609d762135f910.hot-update.js:1349)
at __webpack_require__ (bootstrap 57e69e71aff13ca7b80a:555)
at fn (bootstrap 57e69e71aff13ca7b80a:86)
at Object.<anonymous> (ButtonBase.js?c334:44)
at Object.629 (0.442234609d762135f910.hot-update.js:800)
at __webpack_require__ (bootstrap 57e69e71aff13ca7b80a:555)
at fn (bootstrap 57e69e71aff13ca7b80a:86)
index.js:60类型错误:超级表达式必须为null或函数
at_inherits(inherits.js:7)
在TouchRipple.js?bed4:131
反对。(TouchRipple.js?bed4:348)
位于Object.631(0.442234609d762135f910.hot update.js:1349)
at _u网页包uu需要u uu(引导程序57e69e71aff13ca7b80a:555)
在fn(引导57e69e71aff13ca7b80a:86)
反对。(ButtonBase.js?c334:44)
在Object.629(0.442234609d762135f910.hot update.js:800)
at _u网页包uu需要u uu(引导程序57e69e71aff13ca7b80a:555)
在fn(引导57e69e71aff13ca7b80a:86)
任何人都有过同样的经历,并且知道如何修复它吗?我发现了问题所在,我添加的项目中有一个过时的React版本。当我更新到最新版本时,一切正常。你想发布index.js的第60行吗?另外,尝试从“材质ui/IconButton”导入IconButton;index.js只是引用
react transform hmr
包中的一个文件,它将错误输出到控制台:console.warn(“[react transform hmr]更新“+filename+”时出错:”);控制台错误(err);请发布更多代码。这是一个导入问题。您是否尝试过使用如上所示的导入方法?