Next.js App Router Patterns
The App Router paradigm shift requires adapting to Server Components and new data fetching strategies.
- Server Components by Default: Components are Server Components unless you add
'use client'. This reduces client-side JavaScript. - Server Actions: Mutate data directly on the server without creating an API route. Use them in forms via the
actionprop. - Caching: Next.js caches heavily by default. Use
revalidatePathorrevalidateTagto purge caches when data mutations occur. - Streaming: Wrap slow components in
Suspenseboundaries to stream the UI to the user progressively.