Performance: Server-side state passing
MEDIUM IMPACT
This affects the initial page load speed and time to interactive by controlling how much data is sent from server to client and how quickly the page renders.
export async function getServerSideProps() { const data = await fetch('https://api.example.com/summary').then(res => res.json()); return { props: { summary: data.summary } }; } export default function Page({ summary }) { return <div>{summary}</div>; }
export async function getServerSideProps() { const data = await fetch('https://api.example.com/large-data').then(res => res.json()); return { props: { data } }; } export default function Page({ data }) { return <pre>{JSON.stringify(data, null, 2)}</pre>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Passing large server-side state | No extra DOM nodes | 1 reflow after hydration | High paint cost due to delayed hydration | [X] Bad |
| Passing minimal server-side state | No extra DOM nodes | 1 reflow after hydration | Low paint cost with fast hydration | [OK] Good |