raj*_*aju 4 strict-mode reactjs deprecation-warning react-redux react-redux-notify
我在使用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)
Run Code Online (Sandbox Code Playgroud)
如何纠正这个?
在index.js
移除 <React.StrictMode> 包装器中
ReactDOM.render( <React.StrictMode>
<React.StrictMode> //remove this
<App />
<React.StrictMode/> //remove this as well.
,
document.getElementById('root')
)
Run Code Online (Sandbox Code Playgroud)
到
ReactDOM.render(
<App />,
document.getElementById('root')
)
Run Code Online (Sandbox Code Playgroud)
小智 5
这是一个错误,可能来自您正在使用的库,表示 ReactDOM.findDOMNode 函数现在已弃用,但它仍然有效(将来可能会被删除)。
在 StrictMode 中,会出现错误,但不建议删除 StrictMode,因为错误!最好忽略此错误或通过报告问题联系导致此错误的库。
仅供参考,这是react-bootstrap 中的一个已知问题。
| 归档时间: |
|
| 查看次数: |
10874 次 |
| 最近记录: |