Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Images | Basic Concepts
Next.js 14

ImagesImages

Images play a significant role in the visual appearance of any website. Let's focus on how to add them in Next.js.

The <Image> component is an advanced version of the conventional HTML <img> tag that offers a range of automatic optimizations. It has been designed to address the complexities of modern web design and ensures a visually stable user experience by mitigating layout shifts during the loading phase. The component also resizes images intelligently, which reduces bandwidth consumption on devices with smaller viewports, thus optimizing content delivery.

By default, the Image component uses lazy loading, which helps improve page loading performance by fetching images only as they enter the user's viewport.

Additionally, it supports forward-thinking image formats such as WebP and AVIF, which dynamically adapts to the capabilities of the user's browser, resulting in faster load times and enhanced image quality.

Back to the Project

Let's check out how to incorporate images into our project. In the public folder, you'll find hero-desktop.png and hero-mobile.png. It's time to include them in our app/page.tsx file using the Image component from next/image.

app/page.tsx

Upon navigating to the app's home page, the image should be visible.

For the mobile version, add another image with a width of 560px and a height of 620px. If you encounter any issues, refer to the provided solution below.

app/page.tsx

In Practice

Everything was clear?

Section 2. Chapter 10
course content

Course Content

Next.js 14

ImagesImages

Images play a significant role in the visual appearance of any website. Let's focus on how to add them in Next.js.

The <Image> component is an advanced version of the conventional HTML <img> tag that offers a range of automatic optimizations. It has been designed to address the complexities of modern web design and ensures a visually stable user experience by mitigating layout shifts during the loading phase. The component also resizes images intelligently, which reduces bandwidth consumption on devices with smaller viewports, thus optimizing content delivery.

By default, the Image component uses lazy loading, which helps improve page loading performance by fetching images only as they enter the user's viewport.

Additionally, it supports forward-thinking image formats such as WebP and AVIF, which dynamically adapts to the capabilities of the user's browser, resulting in faster load times and enhanced image quality.

Back to the Project

Let's check out how to incorporate images into our project. In the public folder, you'll find hero-desktop.png and hero-mobile.png. It's time to include them in our app/page.tsx file using the Image component from next/image.

app/page.tsx

Upon navigating to the app's home page, the image should be visible.

For the mobile version, add another image with a width of 560px and a height of 620px. If you encounter any issues, refer to the provided solution below.

app/page.tsx

In Practice

Everything was clear?

Section 2. Chapter 10
some-alt