Server and Client Components

In Next.js with the App Router, components are Server Components by default: they run only on the server, can access data directly, and do not send their code to the browser. A Client Component, marked with 'use client', handles state, events, and browser APIs.

Example

'use client'
import { useState } from 'react'
export default function Compteur() { const [n, setN] = useState(0) }

Related concepts

The whole glossary