I am trying the sample code for React Animation:
- https://reactjs.org/docs/animation.html
- https://github.com/reactjs/react-transition-group/tree/v1-stable
Demo:
https://codesandbox.io/s/dark-forest-ofzfr?file=/src/App.js
<CSSTransitionGroup
transitionName="example"
transitionEnterTimeout={500}
transitionLeaveTimeout={300}
>
{items}
</CSSTransitionGroup>
It doesn't think App
exists in index.js
. But if the CSSTransitionGroup
is replaced by some static text, then it works (without any animation effect):
https://codesandbox.io/s/blue-dust-j0y57?file=/src/App.js
The same with ReactCSSTransitionGroup
:
https://codesandbox.io/s/quizzical-franklin-j2hhp?file=/src/App.js
How can it work?
You should use
TransitionGroup
andCSSTransition
instead ofReactCSSTransitionGroup
andCSSTransitionGroup
. The code looks like belowstyles.css
you can see here in codesandbox, check this doc for more information about migration from v1 to v2