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)
该如何纠正?
答案 0 :(得分:5)
在index.js
中
删除
ReactDOM.render( <React.StrictMode>
<React.StrictMode> //remove this
<App />
<React.StrictMode/> //remove this as well.
,
document.getElementById('root')
)
到
ReactDOM.render(
<App />,
document.getElementById('root')
)
答案 1 :(得分:3)
这可能是您正在使用的库中的一个错误,它是您现在已经不赞成使用ReactDOM.findDOMNode函数,但是该函数仍然有效(将来可能会删除)。
在StrictMode中,将显示错误,但由于该错误,不建议删除StrictMode ! 最好忽略此错误,或者通过报告问题来联系引起此问题的图书馆。
仅供参考,这是react-bootstrap.
中的一个已知问题