Automatic static generation
In Next.js, the filesystem-based routing means that each path in your web application corresponds to a file in the pages
directory of your application. For example, /
corresponds to pages/index.js
.
Next.js defaults to static generation when no Next.js data fetching methods are used for a given page. You can find more information from the Next.js documentation – Automatic Static Optimization (https://nextjs.org/docs/pages/building-your-application/rendering/automatic-static-optimization).
For example, the following page in a Next.js application will be statically generated, since it only exports a page component (the default export of Index
); no getServerSideProps
or getInitialProps
function is exported:
import React from...