-
Static Generation (SSG): This method generates HTML during the build process, with all requests sharing the same HTML. You can use
getStaticPropsto fetch the data required for the page and pass it to the component during the build. Additionally, you can usegetStaticPathsto dynamically generate paths for pages with dynamic routing. -
Server-side Rendering (SSR): This method generates HTML on each request. By using
getServerSideProps, you can fetch data in real-time for each request and pass it as props to the component, rendering the page on the server.
Both pre-rendering approaches enhance performance and SEO. The choice depends on the application's requirements and the characteristics of the pages.