Junior From PDF React React.js

What is static site generation (SSG) in React frameworks like Next.js?

Static Site Generation (SSG) is a technique where HTML pages are generated at build

time. Unlike SSR, SSG pre-renders all pages during the build process, which results in

faster load times.

Example with Next.js (SSG):

import React from 'react';

export async function getStaticProps() {

const data = await fetchDataFromAPI();
return { props: { data } };
}

function Page({ data }) {

return <div>{data}</div>;
}

export default Page;

Here, getStaticProps is a Next.js function that fetches data during build time. The page

is pre-rendered and served as static HTML.

More from React.js Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details