shoutingwei / react-learning

take notes for redux learning
0 stars 0 forks source link

ReactCSSTransitionGroup 中 transitionAppear和transitionEnter区别 #2

Closed shoutingwei closed 6 years ago

shoutingwei commented 6 years ago

transitionAppear:初次mount的时候的动画 默认是不打开的 使用方式: transitionAppear={true} transitionAppearTimeout={500}

transitionEnter:除了初次mount之外,其他都是enter

https://reactjs.org/docs/animation.html

shoutingwei commented 6 years ago

At the initial mount, all children of the ReactCSSTransitionGroup will appear but not enter. However, all children later added to an existing ReactCSSTransitionGroup will enter but not appear. componentWillAppear和 componentDidAppear这两个钩子函数,只能在ReactTransitionGroup初始化的时候,被在刚开始就存在于ReactTransitionGroup中的子元素所触发,并且只能触发一次,后来追加进来的子元素只会触发 componentWillEnter 和 componentDidEnter,而不会触发 Enter。