原文:React 导入组件前段浏览器报错 “Cannot read property 'Component' of undefined”

问题出在这个花括号上,当你写 React 的时候,他只会导入React,并不会导入下面你要用到的Component组件, 所以,将括号去掉就可以了。 别忘记保存。 ...

2020-03-15 15:09 0 733 推荐指数:

查看详情

TypeError: Cannot read property 'Component' of undefined

继续跟着阮一峰的教程走,下面写到PropTypes的getDefaultProps时,又出现了问题,基于上一个createClass的报错换成了Component写法 错误描述: 解决方法:引入react中的Component,将React.Component换成Component ...

Thu Nov 19 19:27:00 CST 2020 0 3829
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM