π How to Trigger Animation Events using React
π¨βπ» By Sonny Recio
How CSS animations were made?
Animation property has a couple of sub-elements:
Animation property can be declared like this:
.mydiv {
animation-duration: 3s;
animation-name: my-animation;
animation-iteration-count: 3;
animation-direction: alternate;
}
Or shorthand version like this:
/* @keyframes duration | timing-function | delay | name */
animation: 3s linear 1s my-animation;
React offers some built-in events for catching animation transitions in our components through the use of SyntheticEvent
which is a cross-browser wrapper around the browserβs native event. Meaning, our React components can use native events because of this wrapper, including preventDefault()
and stopPropagation()
native events.
SyntheticEvent
has some support for animation, these are: