跳转到主要内容
此内容尚未提供您的语言版本,正在以英文显示。

Next.js Server vs. Client Components

Skill 已验证
98

Guide for choosing between Server Components and Client Components in Next.js App Router. CRITICAL for useSearchParams (requires Suspense + 'use client'), navigation (Link, redirect, useRouter), cookies/headers access, and 'use client' directive. Activates when prompt mentions useSearchParams, Suspense, navigation, routing, Link component, redirect, pathname, searchParams, cookies, headers, async components, or 'use client'. Essential for avoiding mixing server/client APIs.

AI 摘要

This skill provides detailed explanations and code examples for differentiating between Next.js Server and Client Components. It covers critical patterns like data fetching, hook usage, navigation, and the React 'use' API, along with common anti-patterns to avoid.

安装

npx skills add wsimmonds/claude-nextjs-skills

通过 npx 运行 Vercel skills CLI(skills.sh)— 需要本地安装 Node.js,以及至少一个兼容 skills 的智能体(Claude Code、Cursor、Codex 等)。前提是仓库遵循 agentskills.io 格式。

7 months ago
90 stars
MIT
更新于 1 day ago
查看源代码