【ReactCSSTransitionGroup】
ReactCSSTransitionGroup
is a high-level API based on ReactTransitionGroup
and is an easy way to perform CSS transitions and animations when a React component enters or leaves the DOM.
import ReactCSSTransitionGroup from 'react-addons-css-transition-group'; // ES6 var ReactCSSTransitionGroup = require('react-addons-css-transition-group'); // ES5 with npm
<ReactCSSTransitionGroup transitionName="example" transitionEnterTimeout={500} transitionLeaveTimeout={300}> {items} </ReactCSSTransitionGroup>
You must provide the key
attribute for all children of ReactCSSTransitionGroup
, even when only rendering a single item. This is how React will determine which children have entered, left, or stayed.
参考:https://facebook.github.io/react/docs/animation.html#getting-started