All examples By author By category About

mattborn

React Animations.

React CSS Transitions

It is common to add and remove elements from the DOM, such as items in a list, status messages (both inline and global shouts), tooltips, dialogs or modal windows, and even entire pages in a refreshless, single-page app. Instead of popping new content into the viewport immediately, it can sometimes be helpful to include animations to help the user keep track of what is changing especially when the changes are subtle. For our purposes today, I’ve exaggerated the transitions for that very reason.

Demo 1

Transition by toggling class

Demo 2

Transition using hidden attribute

Demo 3

React CSSTransitionGroup

5 states when in the DOM

  1. demo-3.jacob-enter
  2. demo-3.jacob-enter.jacob-enter-active
  3. demo-3
  4. demo-3.jacob-leave
  5. demo-3.jacob-leave-active

Demo 4

Duration and child transitions