There's a specific kind of bad animation I notice immediately: the count-up stat that stutters as it ticks, the progress bar that lags a frame behind your scroll, the "active" tab underline that snaps instead of glides. None of it is broken, exactly. It just feels cheap. And nine times out of ten, the cause is the same — the animation is being driven through React state, so every frame triggers a re-render, and the main thread can't keep up.
I build motion-heavy interfaces for a living, mostly in Next.js 16 and React 19, and I've landed on a small set of patterns that stay smooth because they bypass React's render loop entirely. They lean on ).
Here are three I reach for constantly, plus the reduced-motion discipline that should wrap all of them.
The mental model: MotionValues over state
The single idea that fixes most jank: a MotionValue is a value Motion tracks outside of React. When it changes, Motion updates the DOM directly via transform or opacity — it does not call setState, so your component doesn't re-render. That's the whole trick. A number ticking from 0 to 4,200 should touch the DOM ~60 times a second and re-render React zero times.
If a value changes every frame, it should live in a MotionValue, not in
useState. State is for things that change when a user does something; MotionValues are for things that change continuously.
Keep that line in your head and the rest of this falls out naturally.
1. A reading-progress bar with useScroll + useSpring
The bar at the top of an article that fills as you read. The naive version listens to scroll events and sets state — which is exactly the re-render trap. Motion's adds just enough weight that it feels like it has momentum.
"use client";
import { motion, useScroll, useSpring } from "motion/react";
export function ReadingProgress() {
const { scrollYProgress } = useScroll();
const scaleX = useSpring(scrollYProgress, {
stiffness: 120,
damping: 30,
restDelta: 0.001,
});
return (
<motion.div
aria-hidden
style={{ scaleX, transformOrigin: "0%" }}
className="fixed inset-x-0 top-0 z-50 h-1 bg-foreground/80"
/>
);
}
Two details that matter. transformOrigin: "0%" makes it grow from the left instead of the center — easy to forget, very obvious when wrong. And aria-hidden because this is pure decoration; a screen reader announcing "progress bar, 14 percent" on every scroll tick is noise, not information.
This one is safe under reduced motion, and I'll come back to why. It reflects something the user is physically doing. It isn't animating on its own.
2. A count-up that animates only when you scroll to it
This is the pattern people get wrong most often, so it's worth doing carefully. You want a stat — "4,200 projects shipped" — that counts up, but only when it scrolls into view, and without hammering React with 60 re-renders a second.
Four hooks compose here:
on Unsplash.↗ Original-Artikel auf dev.to lesenVollständiger Original-BerichtAusführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
SOCIAL SHARE CARD GENERATOR