Performance: Why client components handle interactivity
HIGH IMPACT
This affects how fast the page becomes interactive and how smoothly user inputs are handled.
'use client'; export default function InteractiveButton() { return <button onClick={() => alert('Clicked!')}>Click me</button>; }
export default function Page() { return <button onClick={() => alert('Clicked!')}>Click me</button>; } // Entire component is server component by default
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Server component with interactivity | Minimal DOM nodes | 0 reflows for events | No paint cost for events | [X] Bad - no client event handling |
| Client component with interactivity | Minimal DOM nodes | 0 reflows for events | Paint cost only on interaction | [OK] Good - responsive interactivity |