Before you go, check out these stories!

0
Hackernoon logoAutomatic Image Optimization: Next.js 10 New Standards for 2020 by@iamrajeev

Automatic Image Optimization: Next.js 10 New Standards for 2020

Author profile picture

@iamrajeevRajeev Sharma

I am Rajeev Sharma, a technical writer who loves to express vital opinions & thoughts on web optimization & performance.

Vercel has recently announced the latest version of its React-based web framework- Next.js 10.

The latest version comes with automatic image optimization as well as user-analytics support to help businesses scale-up their website performance and SEO game.

Automatic Image Optimization

Image optimization is necessary to deliver a first-class experience to the end-users interacting with the website. It serves a plethora of
benefits and some of them have been highlighted below:

  • Improves the loading speed of the pages
  • Better search ranking of the website pages
  • Allows better conversions and engagement
  • Reduces the stress on the server

It’s generally a little complex job for a developer to execute the tasks enabling image-optimization because a lot of factors have to be considered in this process like size, weight, and format.

Also, the complicated building tools used for image optimization often do not recognize the user-submitted images that arrive from an external data source. As a result, the possibility of optimizing ‘all of the images’ is reduced down to zero.

However, the automatic image optimization in Next.js 10 can relax the burden from the shoulders of developers, help them to easily achieve seamless image optimization, and make their jobs easier at the end of the day. The latest Next.js 10 version makes it possible to optimize mages and serve them in next-generation image formats like WebP, if the browser supports it.

This prevents sending large images to the devices having a smaller viewport. Automatic image optimization can also optimize any image source even if the image has been hosted by an external data source. The outcome is an automated image optimization solution, easing the developer’s workload.

Most importantly, Next.js 10 renders the images in such a way so that the core web vitals are not affected and the user-experience is magnified.

The developers can replace the HTML tags with a React-based image component for improving the page responsiveness.

To add the images to the application, the developers can import the ‘next/image’ component as shown below:

The ‘next/image’ component provides the above performance as default.
With the help of this component, the images automatically become responsive and are lazy-loaded as well.

You can use various properties available to the ‘next/image’ component like ‘src’, ‘width’, ‘height’, etc., but apart from that, you can also custom configure the image optimization for fulfilling more advanced use cases with the help of ‘next.config.js’. If no configuration has been provided, then the default configuration shall be used which looks like this:

So, if a particular property has been missed from the above configuration like ‘imagesizes’, then such property shall pick the default from the above. What this means is that a developer will only have to configure those properties that they want to change.

Next Level User Analytics in Next.js 10

To upgrade the performance and speed of a website, it’s important to have access to reliable analytics. Analytics examines how users are
interacting with the website and this data helps to hunt down the areas that need improvement for enhanced web performance and user experience.

Also, when it comes to user analytics, then every website should set goals for improving the core web vitals metrics because it can help in not only improved user-experience and speed but better search ranking as well. The core web vitals have three metrics that provide real-world and actionable insights:

  • LCP (Largest Contentful Paint)
  • FID (First Input Delay)
  • CLS (Cumulative Layout Shift)

Data analysis is important only if it is based on real-world insights like core web vitals. If it is not, then the data won’t be of much use in the decision-making process. In Next.js 10, generating real-world analytics report is an easy job. The custom app component can be created and the ‘reportWebVitals’ function can be defined for measuring core web vital metrics and even custom metrics.

The ‘reportWebVitals’ function can be defined as follows:

It should also be noted that the user analytics feature of Next.js 10
allows continuous measurement of data instead of a one-time measurement so that the marketers can have access to the updated insights. Not just this, but the user analytics from Next.js 10 records the data measurement from the actual devices that are being used by the website visitors instead of relying upon the development device.


Next.js 10 offers next-level user analytics to help developers:

  • Focus on the entire picture
  • Gain a deep understanding of the target audience base
  • Assess how a website performs for the target users


How can ImageEngine act as a Catalyst for Further Advancement in Next.js 10?

There is no doubt that the built-in characteristics of Next.js 10 bring a lot to the table but some smart solutions like Client Hints can further enhance the framework for better utilization. For this purpose, ImageEngine has been helping brands with robust implementation of Client Hints not only for Next.js 10 but many other technologies with the sole objective of scaling up the much-needed web performance. So, what are Client Hints and why do businesses need it?

Client Hints are a group of opt-in HTTP request headers that can provide valuable insights into the aspects like- the capabilities of users’ devices and the network through which such users are connected. This insight is valuable because knowing about the “capabilities of users’ devices” and “how stable their network connectivity is” can help in changing the way content is delivered so that a more inclusive user-experience ecosystem can be developed.


Client Hints are not the only catalyst that ImageEngine has to offer to your business. image CDNs like ImageEngine are also put in use by the creative minds as it helps to reduce the payload and transmit the correct image for every viewport while delivering the images to a network in next-generation image formats like WebP and even AVIF.

These features will not only help one out with better web performance but with other benefits as well such as improved ranking on search engines, better conversions, a better credibility, improved reach, etc. A company’s optimum digital growth and cost-effective scalability is the ultimate objective of ImageEngine.

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.