我从这里使用ReactCSSTransitionGroup:https://facebook.github.io/react/docs/animation.html
有没有办法改变transitionName="example"
让它取一个对象而不是字符串? transitionName={styles.example}
答案 0 :(得分:1)
以下是文档中的示例:https://facebook.github.io/react/docs/animation.html#custom-classes
// ...
<ReactCSSTransitionGroup
transitionName={ {
enter: 'enter',
enterActive: 'enterActive',
leave: 'leave',
leaveActive: 'leaveActive',
appear: 'appear',
appearActive: 'appearActive'
} }>
{item}
</ReactCSSTransitionGroup>
<ReactCSSTransitionGroup
transitionName={ {
enter: 'enter',
leave: 'leave',
appear: 'appear'
} }>
{item2}
</ReactCSSTransitionGroup>
// ...