Skip to content

Repository files navigation

Next.js 13 Rendering Methods

Client-Side Rendering (CSR)

  • How it works: Browser renders page after fetching from server
  • Pros: Flexible, easy to develop, supports dynamic content
  • Cons: Slower load times, SEO challenges

Server-Side Rendering (SSR)

  • How it works: Server renders page before sending to browser
  • Pros: Fast, good for SEO, supports dynamic content
  • Cons: Harder to develop, harder to update

Static Site Generation (SSG)

  • How it works: Server renders page at build time
  • Pros: Fastest, good for SEO, easy to update
  • Cons: Not flexible, no dynamic content

Incremental Static Regeneration (ISR)

  • How it works: Renders at build time + can regenerate at runtime
  • Pros: Fast, good for SEO, flexible, supports dynamic content
  • Cons: Complex to implement

File Structures

pages/
├── csr/ ✅ CSR (Client-Side Rendering)
│ ├── index.js ✅ Infinite scroll + pagination
│ └── [id].js ✅ Client-side fetch
├── dynamics/
│ ├── ssg/ ✅ SSG (Static Site Generation)
│ │ ├── index.js ✅ No revalidate
│ │ └── [id].js ✅ fallback: "blocking", notFound
│ ├── isr/ ✅ ISR (Incremental Static Regeneration)
│ │ ├── index.js ✅ revalidate: 60
│ │ └── [id].js ✅ revalidate: 60, fallback: "blocking"
│ └── ssr/ ✅ SSR (Server-Side Rendering)
│ ├── index.js ✅ getServerSideProps
│ └── [id].js ✅ getServerSideProps
└── static/ ✅ Static (SSG with limit)
├── index.js ✅ Pre-render 20 posts
└── [id].js ✅ Limit to 10, fallback: "blocking"

Use Cases

Use CaseRecommended Method
Highly dynamic, real-time dataCSR or SSR
SEO-critical contentSSR, SSG, or ISR
Static content that rarely changesSSG
Large site with frequently updated contentISR
Simple dashboard or admin panelCSR
Blog or documentation siteSSG
E-commerce product listingISR or SSG
User profile page after loginCSR
News or media websiteISR
Marketing landing pageSSG
Real-time stock pricesCSR
Social media feedCSR
Corporate websiteSSG
Job board with frequent postsISR
Weather dashboardCSR or SSR
Forum or community siteSSR
Recipe or cooking blogSSG
Online course platformISR
Portfolio websiteSSG
Chat applicationCSR
Hotel booking availabilityCSR or SSR
Wiki or knowledge baseSSG
Cryptocurrency trackerCSR
Event listing websiteISR
Restaurant menuSSG
Product review sectionCSR
Job application formCSR
Real estate listingsISR
Music or podcast platformCSR or SSR
Government public data portalSSG or ISR
Sports scores and updatesCSR
Flight status trackerCSR
Coupon or deals websiteISR
Legal or policy documentsSSG
Multi-language siteSSG or ISR
SaaS pricing pageSSG
User dashboard with personal dataCSR
API documentationSSG
Forum thread detail pageSSR
Search results pageSSR or CSR
Checkout or payment pageSSR
Email inbox interfaceCSR
Admin analytics dashboardCSR
Product comparison toolCSR
Countdown or timer pageSSG
Poll or survey pageCSR
Notification centerCSR
User settings pageCSR
File browser interfaceCSR
Calendar or scheduling appCSR or SSR

Quick Selection Rules

If you need...Choose...
Fastest possible load timeSSG
SEO + dynamic dataSSR or ISR
Real-time user-specific dataCSR
Balance of speed and freshnessISR
Zero server costsSSG
Always fresh dataCSR or SSR
Handle millions of pagesSSG or ISR

About

example-nextjs13

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages