

Full-Stack Developer

In the eyes of Google, performance is UX. Core Web Vitals are the standardized metrics used to measure the health of your site's user experience. In this guide, we'll look at how to master these metrics using Next.js.
LCP measures loading performance. To provide a good user experience, LCP should occur within 2.5 seconds of when the page first starts loading. In Next.js, the biggest win for LCP is using the `priority` prop on your hero image.
CLS measures visual stability. We've all experienced pages where text jumps as an image loads—that's poor CLS. Next.js enforces best practices by requiring dimensions for images, effectively 'reserving' the space before the image even loads.
INP is the newest metric, replacing FID. It measures overall responsiveness. A healthy INP score (under 200ms) ensures that your site feels snappy and reactive to user input, even while other things are happening in the background.
import { useReportWebVitals } from 'next/web-vitals'
export function WebVitals() {
useReportWebVitals((metric) => {
console.log(metric)
// Send to your analytics provider
})
}Optimizing for Core Web Vitals is not a one-time task—it's an ongoing commitment to your users. By leveraging the built-in tools in Next.js, you can ensure your site remains fast, stable, and responsive as it grows.