diff --git a/docs/09.1-animation.md b/docs/09.1-animation.md index a24fc64d..f310a13f 100644 --- a/docs/09.1-animation.md +++ b/docs/09.1-animation.md @@ -84,6 +84,35 @@ You'll notice that when you try to remove an item `ReactCSSTransitionGroup` keep } ``` +### Animating One or Zero Items + +Although in the example above we rendered a list of items into `ReactCSSTransitionGroup`, the children of `ReactCSSTransitionGroup` can be one or zero items. This makes it possible to animate a single element entering or leaving. Similarly, you can animate a new element replacing the current element, with the new element animating in while the current animates out. For example, we can implement a simple image carousel like this: + +```javascript{12-14} +/** @jsx React.DOM */ + +var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup; + +var ImageCarousel = React.createClass({ + propTypes: { + imageSrc: React.PropTypes.string.isRequired + }, + render: function() { + return ( +