@@ -53,7 +58,7 @@ var TodoList = React.createClass({
);
}
-});
+}
```
> Note:
@@ -90,8 +95,8 @@ You'll notice that animation durations need to be specified in both the CSS and
`ReactCSSTransitionGroup` provides the optional prop `transitionAppear`, to add an extra transition phase at the initial mount of the component. There is generally no transition phase at the initial mount as the default value of `transitionAppear` is `false`. The following is an example which passes the prop `transitionAppear` with the value `true`.
-```javascript{3-5}
- render: function() {
+```javascript{5-6}
+ render() {
return (
(
+
@@ -179,26 +185,21 @@ In order for it to apply transitions to its children, the `ReactCSSTransitionGro
In the example above, we rendered a list of items into `ReactCSSTransitionGroup`. However, the children of `ReactCSSTransitionGroup` can also 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. For example, we can implement a simple image carousel like this:
-```javascript{10-12}
+```javascript{10}
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
-var ImageCarousel = React.createClass({
- propTypes: {
- imageSrc: React.PropTypes.string.isRequired
- },
- render: function() {
- return (
-
+ );
+}
```
### Disabling Animations
@@ -263,18 +264,16 @@ People often use `ReactTransitionGroup` to animate mounting and unmounting of a
However if you only need to render a single child inside `ReactTransitionGroup`, you can completely avoid wrapping it in a `` or any other DOM component. To do this, create a custom component that renders the first child passed to it directly:
-```javascript{1}
-var FirstChild = React.createClass({
- render: function() {
- var children = React.Children.toArray(this.props.children);
- return children[0] || null;
- }
-});
+```javascript
+function FirstChild(props) {
+ var childrenArray = React.Children.toArray(props.children);
+ return childrenArray[0] || null;
+}
```
Now you can specify `FirstChild` as the `component` prop in `` props and avoid any wrappers in the result DOM:
-```javascript{1}
+```javascript
{someCondition ? : null}