首页 > Web开发 > 详细

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

时间:2020-10-23 17:41:16      阅读:115      评论:0      收藏:0      [点我收藏+]

找到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/

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

原文:https://www.cnblogs.com/zhangyezi/p/13864167.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!