Skip to content

Commit c73de46

Browse files
shelldandysilvenon
authored andcommitted
docs: document key prop trick in TransitionGroup (#467)
* better docs for TransitionGroup about use of `key` prop on children * tweaks from silvenon to merge
1 parent 3a4cf9c commit c73de46

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/TransitionGroup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ TransitionGroup.propTypes = {
122122
* leave. the `<TransitionGroup>` will inject specific transition props, so
123123
* remember to spread them through if you are wrapping the `<Transition>` as
124124
* with our `<Fade>` example.
125+
*
126+
* While this component is meant to make it easier to animate multiple
127+
* `Transition` or `CSSTransition` children, sometimes you want to transition a
128+
* single child by changing its content, e.g. routes, slides, images in a
129+
* carousel etc. In that case you can change the `key` prop of the child
130+
* component along with its content, that way `TransitionGroup` will know that
131+
* it should transition the child.
125132
*/
126133
children: PropTypes.node,
127134

0 commit comments

Comments
 (0)