Performance: Use server directive
HIGH IMPACT
This affects the initial page load speed by moving component rendering to the server, reducing client JavaScript and improving Largest Contentful Paint (LCP).
"use server"; export default function MyComponent() { return <p>This is static content rendered on the server.</p>; }
import React from 'react'; export default function MyComponent() { const [count, setCount] = React.useState(0); return <button onClick={() => setCount(count + 1)}>{count}</button>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Client Component without server directive | High (due to hydration) | Multiple reflows during hydration | High paint cost due to JS execution | [X] Bad |
| Server Component with server directive | Low (static HTML) | Single reflow on initial paint | Low paint cost, no JS execution | [OK] Good |