nextjs-core

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Next.js Core (App Router)

Next.js 核心(App Router)

  • Server Components by default; minimal
    "use client"
    .
  • Mutations in Server Actions (validate/authz; revalidate tags/paths).
  • Route handlers for APIs/webhooks; add loading/error boundaries.
Anti-patterns:
  • ❌ Fetch initial data in
    useEffect
    .
  • ❌ Cache or revalidate too broadly.
  • ❌ Client-only authz.
References: see
references/
(server actions, fetching, caching, routing, auth, testing).
  • 默认使用Server Components;尽量少用
    "use client"
  • 在Server Actions中处理数据变更(验证/授权;重新验证标签/路径)。
  • 路由处理器用于API/网络钩子;添加加载/错误边界。
反模式:
  • ❌ 在
    useEffect
    中获取初始数据。
  • ❌ 缓存或重新验证的范围过宽。
  • ❌ 仅客户端侧授权。
参考资料:查看
references/
目录(包含server actions、数据获取、缓存、路由、授权、测试相关内容)。