原文: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