淡出旧元素,淡入新 [英] fade out old element, fade in new
问题描述
我是新来做出反应,并试图反应动画的。他们工作的伟大,当元素添加或在TransitionGroup删除。但是,如果我替换类似的一个单一元件,反应检测到该元素的内容发生了变化,并不会触发一个动画。
I am new to react and have tried react animations. They work great when elements are added or removed in a TransitionGroup. But if I replace a single element with a similar one, react detects that the content of that element has changed and does not trigger an animation.
我如何淡出的单个元素,并且在同一个地方一个新的褪色?
例如淡出登录-DIV,淡入仪表板DIV。
How can I fade out a single element and fade in a new one in the same place? For example fade out login-div, fade in dashboard-div.
推荐答案
如果您的元素具有不同的键
属性,TransitionGroup将卸载一个,安装等。
If your elements have different key
attributes, TransitionGroup will unmount one and mount the other.
您可以阅读更多关于此键:<一href=\"http://facebook.github.io/react/docs/multiple-components.html#dynamic-children\">http://facebook.github.io/react/docs/multiple-components.html#dynamic-children
You can read more about keys here: http://facebook.github.io/react/docs/multiple-components.html#dynamic-children
这篇关于淡出旧元素,淡入新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!