react中使用antd警告:Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instan...


 

警告內容:

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Wave which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://fb.me/react-strict-mode-find-node


 

 

只要使用antd的組件就會有警告存在  

警告原因:

是因為 react中的嚴格模式: `StrictMode`

react嚴格模式

解決辦法:

在`index.js`中掛載 App 的外面有這樣一個標簽 

只要把這個標簽刪除掉就可以了


 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM