我正在尝试以下简单的显示/隐藏动画,该项目确实出现并消失,但没有任何动画:
toggleChangePassword = () => {
this.setState({ showChangePassword: !this.state.showChangePassword })
}
....
<button onClick={this.toggleChangePassword}>Forgot your password?</button>
<CSSTransitionGroup
transitionName="example"
transitionEnterTimeout={500}
transitionLeaveTimeout={300}>
{this.state.showChangePassword && changePassword}
</CSSTransitionGroup>