简体   繁体   中英

Transition on Mount and Unmount

basically I want to do smth like:

visible ?
<Fade>
   <SomeComponent/>
</Fade> 
: undefined

So I want to transit single elemnts for now, and wouldn't really like to manage the Fade's state from a parent component.

I just want the Fade to be triggered on mount and on unmount. What is the best way to do this?

It depends but you can do it in css with keyframes

ex:

@keyframes myAnimation {
  0%   { opacity: 0; }
  50% { opacity: 1; }
  100%   { opacity: 0; }
}

Then use it like:

 animation:         myAnimation 5s;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM