antd react 警告 index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an


找到index.js 果然默認是嚴格模式,刪除<React.StrictMode>標簽,關閉嚴格模式,警告自然消除了 

antd 版本:4.1.4

引用antd的示例組件一直報警告, 

  1.  
    index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Tabs 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
  2.  
    in div (created by Tabs)
  3.  
    in Tabs (created by Context.Consumer)
  4.  
    in Tabs (at home/index.jsx:18)
  5.  
    in div (at home/index.jsx:17)
  6.  
    in Home (created by Context.Consumer)
  7.  
    in Route (at App.js:14)
  8.  
    in Switch (at App.js:13)
  9.  
    in Router (created by HashRouter)
  10.  
    in HashRouter (at App.js:11)
  11.  
    in App (at src/index.js:9)
  12.  
    in StrictMode (at src/index.js:8)

經過開發者的issue回復,原來是把嚴格模式加入了版本改動中 

 

找到index.js 果然默認是嚴格模式,刪除<React.StrictMode>標簽,關閉嚴格模式,警告自然消除了 

 

原文鏈接:https://blog.csdn.net/chunchun1230/article/details/105679419/


免責聲明!

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



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