Day-03
β 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 3export 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