I'm using react-transition-group to animate transtitions between pages in react-router.
When i don't use nodeRef={nodeRef} animation works fine but I get this error:
"findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: fb.me/react-strict-mode-find-node"
When I use nodeRef={nodeRed} animation does't work but I don't get an error.
How to do it to not get an error and have working animation
import React, { useRef } from 'react';
import { TransitionGroup, CSSTransition } from 'react-transition-group';
const nodeRef = useRef(null)
<Route render={({location}) => (
<TransitionGroup>
<CSSTransition nodeRef={nodeRef} key={location.key} timeout={2000} classNames="fade">
<Switch location={location}>
<Route path='/' exact component={Home}/>
<Route path='/about' component={About}/>
<Route path='/skills' component={Skills}/>
<Route path='/projects' component={Projects}/>
<Route path='/contact' component={Contact}/>
</Switch>
</CSSTransition>
</TransitionGroup>
)} />
</Router>```