Accessing PropTypes via the main React package is deprecated

1.Warning: Accessing PropTypes via the main React package is deprecated. Use the prop-types package from npm instead.

2.Warning: RouterContext: React.createClass is deprecated and will be removed in version 16. Use plain JavaScript classes instead. If you're not yet ready to migrate, create-react-class is available on npm as a drop-in replacement.



“import { Button } from 'antd';”這個語法導致的1和2的問題是嗎


你這個只是warning,并不影響開發的,其實你不用管的。

至于出現warning的原因,里面已經說的很清楚了:

PropTypes已經不建議直接從react中獲取了,而是從prop-types組件中獲取

createClass也會在react 16中去除,所以不建議使用。

可能是因為你引入的某些組件還在使用這些東西吧,不過只是warning并不影響開發的。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • React Native Controllers Important: Please review the fol...
    taiji1985閱讀 1,884評論 0 1
  • Correctness AdapterViewChildren Summary: AdapterViews can...
    MarcusMa閱讀 8,925評論 0 6
  • #一練每日晨問#6月第1周 發現 生命就是一場發現的游戲。學習是一個發現的過程。你只能看見你想看見的,你也只能聽到...
    Archer莫閱讀 196評論 0 0
  • 茫茫人海,漫漫征途,我從來都是默默提醒自己,保持著一顆謙卑的心,不敢有絲毫僭越! 因為,世界太大,路還漫長!
    粉條好吃不啦閱讀 289評論 0 1
  • 橙黃色的外皮,形如一個略被擠壓過的小皮球。上頭出一支梗,攜幾片葉,梗邊的皮兒稍有皺褶,興許是想冒名頂替中國的...
    April2005閱讀 362評論 0 0