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
course content

Зміст курсу

Next.js 14

Next.js 14

1. Introduction
2. Basic Concepts
3. Pages and Layouts
4. Deployment and Database
5. Working with Data
6. Advanced Features
7. Authentication

Images

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.

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.

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.

In Practice

Все було зрозуміло?

Секція 2. Розділ 10
We're sorry to hear that something went wrong. What happened?
some-alt