Next.js - what is Static Site Generation? (SSG)
Can you explain to me what is Static Site Generation in Next.js?
Static Site Generation, also called pre-rendering allows you to render your application at build time.
SSG is a software that generates a complete, static HTML website from plain text files, typically written in markdown format. The HTML, CSS, and JavaScript files generated by the SSG are served by a web server without any server-side processing or database queries. This makes websites fast, secure, scalable, easy to deploy and host.
In Next.js each page or component can implement a function called getStaticProps(), that can fetch data from the database and then pass the data as props to the component.
You can then build your application to render all the HTML locally and upload it to the storage bucket when it can be easily cached by a CDN. It works great for applications where the data doesn't change often, like e.g. blogs.