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