WARNING: findDOMNode is deprecated in StrictMode, react-redux-notify

raju picture raju · Mar 22, 2020 · Viewed 9.9k times · Source

I am getting this warning while using, 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)

How to correct this?

Answer

Mauricio Cartagena picture Mauricio Cartagena · Apr 16, 2020

in index.js remove <React.StrictMode> wrapper

ReactDOM.render(                                                                              <React.StrictMode>
  <React.StrictMode> //remove this
    <App />
  <React.StrictMode/> //remove this as well.
,
  document.getElementById('root')
)

to

ReactDOM.render(
      <App />,
      document.getElementById('root')
)