DEV Community

Discussion on: Animations with the Emotion library

Collapse
 
quintisimo profile image
Quintus Cardozo

Is there an advantage of using the keyframes export in emotion over just defining the @keyframes in line with the css?

Collapse
 
paulryan7 profile image
Paul Ryan

If you were to define it in the CSS it wouldn't be reusable so any place you need to use the animation you would need to duplicate the code. You could then pop it in easily like this:

<div
    css={css`
      animation: ${hop} 1s ease infinite;
    `}
  >
    some bouncing text!
  </div>
Collapse
 
quintisimo profile image
Quintus Cardozo

Ahh I see. I'm just getting into emotion and this post was quiet helpful