Put in order · JavaScript and React course · Module 7: Styling and Animations

Steps to Create CSS Animations in React

Order the steps for adding CSS animations to a React component:

Items to put in order

  • Assign the animation to a CSS class (animation-name, duration)
  • Conditionally add a CSS class based on state
  • Create state in the React component (e.g. isVisible)
  • Define @keyframes with stages (from/to or 0%-100%)
  • React re-renders the element - the browser triggers the animation

You can check the correct answer by solving this task in the CodeWorlds game.