How do you create Client Components in App Router?

Beginner

Answer

Use the 'use client' directive at the top of the file:

'use client';

import { useState } from 'react';

function Counter() {
  const [count, setCount] = useState(0);
  
  return (
    <button onClick={() => setCount(count + 1)}>
      Count: {count}
    </button>
  );
}