June 5, 2020


Connecting People

Next.js upgrade emphasizes static site generation

Next.js, positioned as a Respond framework for the enterprise, is offered in a new edition that emphasizes static site generation. The update, Next.js 9.3, was produced on March 9.

Next.js 9.3 contains API additions that supply constructed-in, optimized static site generation through new data-fetching solutions. These solutions include things like `getStaticProps`, which is utilized to fetch data at construct time and specify dynamic routes to pre-render based on data, and `getServerSideProps`, which fetches data on every ask for.

Next.js 9.3 also attributes a way to present parameters to statically make static internet pages for dynamic routes, called `getStaticPaths`. The new solutions present pros more than the prior `getInitialPaths` model, giving a crystal clear distinction in between server-aspect rendering and static generation. 

Other new abilities and improvements in Next.js 9.3 include things like:

  • A 32KB reduction in the runtime for all Next.js programs, done through optimizations.
  • Preview Manner, for bypassing statically produced internet pages to exhibit drafts from a CMS.
  • Created-in Sass support for global stylesheets, with programs now able to right import .scss files as global stylesheets.
  • Created-in CSS module support for component-amount types, in which locally scoped CSS can be imported and utilized in an application, working with the `module.scss` file conference.
  • Automatic static optimization for the 404 page, with improved trustworthiness and pace by statically serving the 404 page.

All improvements cited for Next.js 9.3 are non-breaking and backward-appropriate. To obtain the improve, builders should run the following command:

$ npm i [email protected] [email protected] [email protected]

Copyright © 2020 IDG Communications, Inc.