Performance: Why SEO matters for Next.js
HIGH IMPACT
SEO impacts how fast and well search engines can index your Next.js pages, affecting your site's visibility and user traffic.
export async function getServerSideProps() { const res = await fetch('https://api.example.com/data'); const data = await res.json(); return { props: { text: data.text } }; } export default function Page({ text }) { return <div>{text}</div>; }
export default function Page() { return <div>{fetch('/api/data').then(res => res.json()).then(data => data.text)}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Client-side data fetching | Minimal initially, but delayed DOM update | Multiple reflows as content loads | Higher paint cost due to incremental updates | [X] Bad |
| Server-side rendering with getServerSideProps | Full DOM ready on load | Single reflow | Lower paint cost with immediate content | [OK] Good |