Skip to content

Framer Motion Variants Not Propagating — Fix Child Animations

DodaTech Updated 2026-06-24 2 min read

In this fix, you'll learn how to use variants for orchestrated animations. This matters for coordinated multi-element animations, and appears in staggered list animations and page transitions.

The Problem

The following code demonstrates the typical mistake:

const variants = {
  visible: { opacity: 1 },
  hidden: { opacity: 0 },
};
return (
  <motion.div variants={variants}>
    <motion.div>Child</motion.div> {/* doesn't animate */}
  </motion.div>
);
// Child doesn't fade in — missing variants prop on child

The Fix

Here is the corrected version:

const listVariants = {
  visible: { transition: { staggerChildren: 0.1 } },
  hidden: {},
};
const itemVariants = {
  visible: { opacity: 1, x: 0 },
  hidden: { opacity: 0, x: -20 },
};
return (
  <motion.ul variants={listVariants} initial="hidden" animate="visible">
    <motion.li variants={itemVariants}>Item</motion.li>
  </motion.ul>
);
// Items stagger in with slide animation

Prevention

  • Define variants separately for parent and children.
  • Use initial and animate on the parent to propagate animation states.
  • Use staggerChildren in parent variants to delay child animations.
  • Children inherit the parent's animate state if they have matching variant names.
  • Variants support transition properties like staggerChildren, delayChildren, and when.

Common Mistakes with framer motion variants

  1. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  2. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  3. Misunderstanding that String is [Char] with poor performance for large text operations

These mistakes appear frequently in real-world REACT code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### How do variants propagate to children?

When a parent has initial and animate set to variant names, Framer Motion looks for child motion elements with matching variant names in their own variants prop.

What is staggerChildren for?

staggerChildren creates a delay between each child's animation start. Set in parent's transition: visible: { transition: { staggerChildren: 0.1 } }.

Can I use variants without propagation?

Yes — use variants on a single element without children. Just a cleaner way to define multiple animation states.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro