When Framer Motion is Overkill
What you'll learn: How to recognize when a simple CSS transition is faster, lighter, and more appropriate than pulling in Framer Motion.
The Problem with Reaching for Heavy Tools
Framer Motion is powerful, but it's also a ~50KB library that adds JavaScript overhead to every animation. For simple effects—like fading in a button on hover, sliding a menu open, or transitioning background colors—you're paying a performance cost for features you don't need.
The analogy: Using Framer Motion for a simple fade is like renting a moving truck to transport a single box. Sure, it works, but a backpack would've done the job with less hassle and zero gas money.
When CSS Transitions Are Enough
Stick with plain CSS transition when:
- No mount/unmount animations needed: The element stays in the DOM, just changing styles (hover states, focus rings, color shifts).
- Single-property changes: Animating
opacity,transform, orbackground-colorbased on a class toggle. - Performance-critical scenarios: Mobile devices, high-frequency updates, or animations running constantly.
- Tiny bundle size matters: Every KB counts in your initial load.
Example scenario: A button that brightens on hover. A CSS transition: background-color 0.2s ease handles this perfectly—no JavaScript runtime cost, no library import, just native browser optimization.
When Framer Motion Makes Sense
Use Framer Motion when you need:
- Mount/unmount animations (exit animations before removing from DOM)
- Complex orchestration (staggered children, sequenced effects)
- Spring physics or gesture-driven interactions
- Variants coordinating multiple states across components
Key Takeaway
Don't import Framer Motion until you've outgrown CSS transitions—simple hover effects, color changes, and basic transforms belong in CSS for better performance and smaller bundles.