Learn/Next.js/Chapter 15

Chapter 15 of 21

Continue learning Next.js step by step.

71%
Chapter 15

Images & Fonts

Learn about image and font optimization in Next.js.

Theory

Next.js provides an Image component for optimized image loading. Next.js also provides tools for loading fonts efficiently. These features can help improve website performance and user experience.

Example

import Image from "next/image";

export default function Profile() {
  return (
    <Image
      src="/profile.png"
      alt="Profile"
      width={300}
      height={300}
    />
  );
}

Output

The image is rendered using Next.js image optimization.

Practice

Add an optimized image to a Next.js page.

Interview Questions

1

What is next/image?

2

Why is image optimization useful?

3

How does Next.js help with fonts?

Quick Quiz

Which option best describes this chapter?

A.next/image
B.next/photo
C.react/image
D.image-next