reactjs - 警告:在 StrictMode 中不推荐使用 findDOMNode,react-redux-notify
问题描述
index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of CSSTransitionGroupChild which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: ---/react-strict-mode-find-node
in div (created by Notification)
in Notification (created by Notify)
in CSSTransitionGroupChild (created by TransitionGroup)
in div (created by TransitionGroup)
in TransitionGroup (created by CSSTransitionGroup)
in CSSTransitionGroup (created by Notify)
in div (created by Notify)
in Notify (created by ConnectFunction)
in ConnectFunction (at App.js:56)
in div (at App.js:55)
in Provider (at App.js:54)
in App (at src/index.js:9)
in StrictMode (at src/index.js:8)
如何纠正这个?
解决方案
在index.js
删除 <React.StrictMode> 包装
ReactDOM.render( <React.StrictMode>
<React.StrictMode> //remove this
<App />
<React.StrictMode/> //remove this as well.
,
document.getElementById('root')
)
至
ReactDOM.render(
<App />,
document.getElementById('root')
)
推荐阅读
- excel - 在 Excel 中使用单个值而不是表格创建饼图
- javascript - D3 v7 中的 forEach 等价于什么?
- stm32 - Rtos 的 Stm32 硬故障异常
- powerapps - 当我的切换按钮为“否”时如何禁用数据卡?
- reactjs - React props - 努力区分联合类型
- r - 当存在某些条件时,如何将观察移动到下一行?
- image-processing - 如何在固定帧的视频中跟踪对象的位置?
- javascript - 避免用 string.replace 替换以前的字母
- python - 如何使用 Selenium e Tor 按下“不可见”按钮,但知道 html ID?
- sql - 如何使用其他列值的连接更新列