Next.js itself comes with several built-in components which simplifies implementing some common UI optimizations. These include:
Images: The Image Component is an abstraction of the native HTML <img> element. It automatically lazy loads images, meaning images are loaded only when they are about to be displayed on the screen, reducing initial page load times. In addition, the Image Component automatically resizes images based on the device size.
Link: The Link Component is an abstraction of the native HTML <a> (anchor) tags. The Link Component prefetches the linked pages in the background, anticipating user interactions and loading the necessary page data in advance.
Scripts: The Script Component is an abstraction of the native HTML <script> tags. It allows developers to control the loading and executing third-party scripts.
Code-splitting: Each file in the pages/ directory is automatically code split (splitting the app bundle into smaller chunks) during the build step. This reduces initial load time by only loading required code.
Fonts: After creating a CSS file for the font import, add the ‘font-display’ property to the @font-face rule for the browser to display the font according to the font-display property value set.
The font-display property has the following values:
For example, to set the font-display to swap:

The deployment process varies depending on the hosting provider chosen. An estimate of what the process looks like is as follows:
Before deploying, we must build the production version of the app. Open the terminal or command prompt, navigate to the project directory, and run the following command:
npm run build