加入 <CSSTransition> 后警告
来源:7-6 React Transition Group 实践 - 动画效果第二种实现方式

慕侠0187444
2020-05-20
index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference.
老师,请问如何不让React报这个警告 网上说去掉 index.jsx 里面的 <React.StrictMode> 标签,还有别的解决方法么?
写回答
2回答
-
同学你好
这个错误是 CSSTransition组件 内部的警告,就是说我们使用的这个库它使用了 findDOMNode,所以我们只能等它升级以后不使用这个方法,这样警告就消失了。
112020-05-21 -
weixin_慕田峪6589005
2022-04-03
现在更新到4.4.4了,还是有这个错误。在网上找了找,需要使用useRef,指定nodeRef来避免这个错误。
30
相似问题