原文:TypeError: Cannot read property 'Component' of undefined

继续跟着阮一峰的教程走,下面写到PropTypes的getDefaultProps时,又出现了问题,基于上一个createClass的报错换成了Component写法 错误描述: 解决方法:引入react中的Component,将React.Component换成Component,原本的getDefaultProps换成defaultProps,并以使用属性的方式设置defaultProps 这 ...

2020-11-19 11:27 0 3829 推荐指数:

查看详情

TypeError: Cannot read property 'setData' of undefined

刚刚入手小程序没多久 今天在写小程序时用到 this.setData时会报错 这个让我想起了 react this.setState({}) 一般在react中写点击事件的时候 都 ...

Thu Jul 02 22:39:00 CST 2020 0 852
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM