NextJS is a framework to build a full-stack application with features such as server-side rendering using the React framework.

NextJS is used to build HTTP web applications to run react code, rendering on the server side. NextJS helps to develop the following different types of applications.

  • Static sites: In this, HTML files are created at build time and copied this HTML files to CDN or Web server and accessible as static HTML files. - These techniques are used for blogging websites and content-related sites where content changes are not frequent

  • incremental static regeneration (ISR) In this, All the static HTML pages are generated at build time, any new page that is created or updated is generated at runtime, not the build time. Incremental means any new pages that were created updated or deleted. It does not generate all pages at runtime.

    These can be used in eCommerce sites as new products are added or existing products are updated with prices daily.

  • Single Page Applications

The name itself tells that the entire application has a single HTML page that loads on the client side.

It is a web application that loads the entire page initially, based on client request, It loads and updates the HTML body using javascript.

It is client Side Rendering.

  • Server Side Rendering(SSR) Normally, when a request is sent from the client, the Client executes the javascript code generates HTML, and renders it to the user on the Client Side. In the SSR technique, the Server works as the opposite of single-page applications When a request is sent from a client to a server, the Server generates HTML sends HTML code to the client, and displays it to the user.

The initial load time with this approach is very slow.

NextJS advantages

  • Server-side rendering and Single Page Application development
  • Static Site Generator
  • Code splitting
  • SEO
  • Build optimizations
  • Progress app features such as offline, prerender
  • Supports pre-generate HTML in the server as well as in-browser at build/run time
  • It is faster in development and development loading is good
  • Image Optimization
  • Page Routing
  • Better User experience
  • Hot Reloading

NextJS disadvantages

  • It is overkill for simple applications
  • Build time is more
  • Limited plugins
  • State Management is not provided as part of the framework