The official documentation states that you need to provide a key for each element inside the ReactCSSTransitionGroup
React uses this key to manipulate the DOM. Therefore, it must be unique. Also, in my experience, you should have the Appear and transitionEnter transitions set in the same way, so that the initial animation and the animation for the change look the same.
So, you need to provide some unique keys (or at least different between the current state (or props) and the next state (or props) of the child for each change) for the ReactCSSTransitionGroup
<ReactCSSTransitionGroup transitionName="example" transitionAppear={true} transitionAppearTimeout={500} transitionLeaveTimeout={500} transitionEnterTimeout={500}> <h1 key={key}>Hello, {name}</h1> <ReactCSSTransitionGroup>
You can check out JSFIDDLE to find out how this works.
NOTICE that I used {this.state.name} as a key, so it works fine in my example. But in the real world, I think you should use something else as a key
source share