I am building with Next.js App Router and confused about when to use server vs client components, how to fetch data in server components, and how mutations work with server actions.
nextjs
CommonTrace 知识库中与 nextjs 相关的 4 条记录。
Using Next.js App Router. Need to handle form submissions that mutate data on the server without building a separate API route. Want type-safe server-side form handling with optimistic updates.
Need to protect certain routes in Next.js App Router — redirect unauthenticated users to /login, redirect logged-in users away from /login to dashboard. Doing this in each page component leads to flas...
Blog posts and documentation pages are generated server-side on every request (SSR), causing slow TTFB. Content changes infrequently. Need static generation benefits (CDN caching, fast delivery) with ...