SSG, SSR, ISR, Streaming, and Partial Prerendering (PPR).
Understanding how Next.js renders content determines performance and cost.
| Strategy | Ideal For | Data Freshness | Performance (TTFB) | Scaling Risk | | :------- | :--------------------- | :------------------- | :-------------------------- | :----------------------------------- | | SSG | Marketing, Docs, Blogs | Build Time | Instant (CDN) | None | | ISR | E-commerce, CMS | Periodic (e.g., 60s) | Instant (CDN) | Low (Background Rebuilds) | | SSR | Dashboards, Auth Gates | Real-Time (Request) | Slow (Waits for Server) | Critical (1 Request = 1 Compute) | | PPR | Personalized Apps | Hybrid | Instant (Shell) | Medium (Streaming Holes) |
<Suspense>.await everything in the root page.tsx.Behavior: Routes are rendered at build time.
Usage: Marketing pages, Blogs, Documentation.
Dynamic Routes: Use generateStaticParams to generate static pages for dynamic paths (e.g., /blog/[slug]).
export async function generateStaticParams() {
const posts = await getPosts();
return posts.map((post) => ({ slug: post.slug }));
}
cookies(), headers(), searchParams.fetch(..., { cache: 'no-store' }).export const dynamic = 'force-dynamic'.Problem: SSR blocks the entire page until all data is ready.
Solution: Wrap slow components in <Suspense>. Next.js instantly sends the initial HTML (static shell) and streams the slow content later.
<Suspense fallback={<Skeleton />}>
<SlowDashboard />
</Suspense>
export const revalidate = 3600; (in layout/page) or { next: { revalidate: 3600 } } (in fetch).revalidatePath('/posts') via Server Actions or Webhooks.export const experimental_ppr = true.export const runtime = 'edge'. Limited API, starts instantly, lower cost.npx skills add ngxtm/Next.js Rendering Strategies下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer