'use client'

The directive that marks a module as the entry point to client code, so it and its imports are sent to the browser.

In more detail

Place it at the very top of a file. It marks a boundary, not a single component: everything imported below it is client code. Push it as far down the tree as you can so most of the page stays on the server.

Example

'use client';
import { useState } from 'react';

Related terms

Taught in

References