Framer Motion is a production-ready animation library for React that lets you describe animations as states instead of imperative timelines. Useinitial, animate, and exit plus transitions to express intent, and let Motion handle the spring/tween math. Orchestrate groups with variants andstaggerChildren, keep durations consistent, and use layout / layoutId for shared-element transitions without flicker.
“Animate state changes—not DOM nodes.”
// Framer Motion pattern: variants + layout + exit
import { motion } from "framer-motion";
const card = {
initial: { opacity: 0, y: 24 },
animate: { opacity: 1, y: 0, transition: { duration: 0.22 } },
exit: { opacity: 0, y: -16, transition: { duration: 0.18 } }
};
export default function Example() {
return (
<motion.div
layout
initial="initial"
animate="animate"
exit="exit"
variants={card}
whileHover={{ scale: 1.02 }}
/>
);
}