Rendering Strategies

Rendering Method Behavior Best Use Case Next.js API
SSR Server generates a new HTML page on every request Dynamic, frequently updated data fetch(...)
SSG Pre-built static HTML served from cache Static content (blogs, docs) fetch(..., { cache: "force-cache" })
ISR Statically generated pages revalidated at intervals Content that updates periodically but doesn’t require real-time updates fetch(..., { next: { revalidate: X } })
CSR Browser renders content after downloading JS Highly interactive apps with minimal SEO concerns fetch() in useEffect()

页面和fetch缓存级别

Fetch & Cache & Memoization

Prerendering

标准 SSG/SSR 流程:全静态(无 dynamic API)或全动态(有 dynamic API)

export const dynamic = 'force-static' // 全静态
export const dynamic = 'force-dynamic' // 全动态

Partial Prerendering

Static Rendering

(build time or through revalidation): 同一个页面有些地方是预渲染成static内容

Dynamic Rendering

(using dynamic APIs): HTML is generated at request time

A component becomes dynamic if it uses the following APIs: