Next.js Developer interview question · Most asked

What does `next/image` do?

Summary

<Image> automatically resizes, optimizes and serves modern formats (WebP/AVIF), lazy-loads images by default, prevents layout shift by requiring dimensions (or fill), and generates responsive srcsets.

Longer Answer

Remote images need images.remotePatterns configured. Use priority (or fetchPriority='high') for the Largest Contentful Paint image, sizes for responsive layouts, and placeholder='blur' for nicer loading. Self-hosting needs the optimization server (or a custom loader / CDN).

Key Points

  • Automatic resizing and modern formats
  • Lazy loading by default
  • Width/height or fill prevents CLS
  • priority for the LCP image
  • remotePatterns for external hosts

More most-asked Next.js Developer questions

← All Next.js Developer questions