We are excited today to introduce Next.js 9.3, featuring:
All of these benefits are non-breaking and fully backwards compatible. All you need to do to update is run:
When building websites or web applications you generally have to choose between 2 strategies: Static generation ( SSG ) or server-side rendering ( SSR ).
Next.js is the first hybrid framework, allowing you to choose the technique that fits your use case best on a per-page basis.
Next.js 9.0 introduced the concept of Automatic Static Optimization . When a page does not have blocking data fetching requirements like getInitialProps , it will be automatically rendered to HTML at build time.
There are more cases where you might want to render a page…
This is an excerpt. The full article is published by Next.js Blog.
Answers to common questions regarding this article's topic, architecture, and practical applications.
We are excited today to introduce Next.js 9.3, featuring:
How It Works
When building websites or web applications you generally have to choose between 2 strategies: Static generation (SSG) or server-side rendering (SSR). Next.js is the first hybrid framework, allowing you to choose the technique that fits your use case best on a per-page basis. Next.js 9.0 introduced the concept of Automatic Static Optimization. When a page does not have blocking data fetching requirements like getInitialProps, it will be automatica
General
If you export an async function called getStaticProps from a page, Next.js will pre-render this page at build time. This is especially useful when you want to render specific static pages from a CMS. getStaticProps always runs in the Node.js context and the code is automatically tree-shaken from browser bundles, ensuring that less code is sent to the browser. This way you don't have to worry about the execution of data fetching code in both Node.
General
If a page has dynamic routes and uses getStaticProps it needs to define a list of paths that have to be rendered to HTML at build time. If you export an async function called getStaticPaths from a page that uses dynamic routes, Next.js will statically pre-render all the paths specified by getStaticPaths.
General
The paths key determines which paths will be pre-rendered. For example, suppose that you have a page that uses dynamic routes named pages/posts/[id].js. If you export getStaticPaths from this page and return the following for paths: return {
paths: [
{ params: { id: 1 } },
{ params: { id: 2 } }
],
fallback: ...
}
Then Next.js will statically generate posts/1 and posts/2 at build time using the page component in pages/posts/[id].js.