βœ… Rendering in next.js

πŸ‘‰ next.js 4 different type of render use

πŸ‘‰ 1. SSR - Server Side Rendering

πŸ‘‰ 2. SSG - Server Side Generation

πŸ‘‰ 3. CSR - Client Side Rendering

πŸ‘‰ 4. ISR - Incremental Site Rendering

⚠️ Next.js Only send html file where page request and anther page file send in rsc [react-server-component] file. and its use api call to fetch rsc

πŸ‘‰ By default ssr use by next.js

βœ… Static Rendering and Dynamic Rendering

πŸ‘‰ Static File create when build and every time server build file

πŸ‘‰ dynamic routes file build on fly [realtime build on next js server]

πŸ‘‰ default only visible links csr data coming on request

πŸ‘‰ Next.js 13+ use a custom MIME type to stream component data from the server to the client.

βœ… Static Site Generation in Next.js | SSG

πŸ‘‰ SSG create static file on build

πŸ‘‰ generateStaticParams() export and return it possible value of params so based on generate static file on build time

View Blog 1View Blog 2View Blog 3
export function generateStaticParams(){
    return [
        {blogId: "1"},
        {blogId: "2"},
        {blogId: "3"},
        {blogId: "4"},
        {blogId: "5"},
    ]
}

πŸ‘‰ make it async to call api and return data so generate static file on build time.

πŸ‘‰ but generateStaticParams use after on runtime new routes hit when generate related static page automatically.

πŸ‘‰ so if dynamic routes generate new file prevent dynamicParams fn. default export. it