警告:在StrictMode模式下,findDOMNode已被弃用,react-redux-notify

4

我在使用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)

如何纠正这个问题?

1个回答

5

这是一个错误,可能来自你正在使用的库,用于表明ReactDOM.findDOMNode功能已被弃用但仍然可以使用(将来可能会被删除)。

在StrictMode下,错误将会显示,但不建议删除StrictMode因为出现了这个错误!最好忽略这个错误或者向造成此问题的库报告此问题。

知情者可以参考react-bootstrap中的已知问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接