Skip to main content

Why do you need Next.js

2024-01-16

There are many different types of technology and different direction one can take while planning to build a website or web application.  Which technology to use depends on what the business strategy requires. For example, SSR (Server Side Rendering) usually provides a better SEO score and will have a faster initial load. 

In the era of SPA (Single Page Application), many websites only use front-end frameworks such as React or Vue without a framework or back-end support. To achieve SSR in these cases, many settings need to be made. It could potentially cost a significant amount of time and effort to do these technical studies, and be imported into your project.

This is where Next.js comes in. With Next.js, you no longer need to spend a lot of time dealing with pre-rendering or SSR problems. Instead, the advantages of the framework are used to allow engineers to focus more on developing core functions.

Server Side Rendering and Static Side Generation

Next.js is a framework based on React. It supports SSR and SSG(Static Side Generation) at the same time. The project can now achieve these functions with fairly little configuration.

Next.js allows us to incorporate two different methods in our design. For example, SSR can be used if the content of the website changes frequently and needs API support for frequently changing data and SSG can be used on the page, where the content changes less often, such as Landing Pages.

Image file optimization

Besides the content of the website, SEO score is also one of the essentials when talking about core web vitals. The scoring criteria include the speed of the website, whether to use newer image formats, etc., so the website may choose the WebP file format. WebP is 45% smaller in file size than PNG according to google's lossless compression test. If you want to use this file format and want to process it automatically, you must use Webpack or Gulp to add some plugins for processing, which could not only be troublesome to set up but also maintains a lot of configuration files afterwards. These can be regarded as a considerable cost. 

Next.js provides a corresponding solution, you can use the built-in image optimization solution to automatically process the format of the image. There is no need to install additional plug-ins to generate image files in different formats, and can be based on different browsers, providing support for image files, which can reduce a lot of cumbersome code.

API routes

Next.js is a full-end framework, it provides the ability to build APIs in addition to the React part. If you are about to start working on a new project that requires API services, you might want to consider using Next.js's API routes.

Conclusion

After reading the basic introduction of Next.js, you may be thinking about the risks of importing new technologies. One of the concerns about importing a new technology is that there are not enough data sources. This may give you a feeling of not being able to find the documentation you need when you run into an issue. However, the number of users using Next.js has grown linearly every month, and so far, there have been close to 4 million downloads per week.

With that number in mind, we know that the Next.js framework has and will even further, gradually mature, and the community and resources are increasing at a rapid rate. Therefore, there will be more and more documentation, examples, and solutions online that are ready to help you when you need them. Feel free to reach out to use if you have a project in mind that you are considering leveraging Next.Js and our experts here will be more than happy to help you.

Frontend Web Development Optimization