QuickDevGuide

Home › Next.js

Server & Client Components — Next.js

In the App Router, all components are Server Components by default. They run only on the server, send zero JavaScript to the browser, and can directly access databases, APIs, and file systems. Server Components (Default) Client Components Add 'use client' at the top of a file to make it a Client Component. Use these only when you need interactivity: Composition Pattern — Mix Both The key pattern: keep pages as Server Components and extract interactive parts into Client Components: When to Use Which? Need Component Type Fetch data, access DB Server Component Access secrets/env vars Server Component Display static content Server Component onClick, onChange events Client Component useState, useEffect Client Component Browser APIs (window, localStorage) Client Component

Key Takeaways