Module 1: App Router & RSC

The Foundation: Server Components vs. Client Components.

1. The Mental Model

In the "Old" React (and Pages Router), everything was bundled and sent to the browser. The browser did the heavy lifting (Hydration).

In the App Router, components render on the server by default. They send HTML to the browser, not JavaScript logic (unless needed).

1.1 React Server Components (RSC)

1.2 Client Components

Marked with "use client" at the top of the file.

2. The Setup Challenge

Task: Initialize Next.js

  1. Run npx create-next-app@latest my-next-app.
  2. Select: TypeScript, ESLint, Tailwind CSS, App Router (Yes).
  3. Clean up `page.tsx` and `globals.css`.

3. The Build Challenge: "Hybrid Page"

Requirements

Create a page that demonstrates the split between Server and Client.

NEXT-001 Concept

The Network Boundary

Question: What happens if you try to pass a function (like `onClick={() => log('hi')}`) from a Server Component to a Client Component?

Answer: It fails. Functions are not serializable. You can pass data (strings, numbers, objects), but not functions, unless they are Server Actions (Module 3).