Performance: Why Next.js over plain React
HIGH IMPACT
This affects page load speed and time to interactive by optimizing server rendering and static generation.
import React from 'react'; export default function Home() { return <h1>Hello World</h1>; } // Next.js automatically pre-renders this page at build time or on server request
import React from 'react'; import ReactDOM from 'react-dom/client'; function App() { return <h1>Hello World</h1>; } const root = ReactDOM.createRoot(document.getElementById('root')); root.render(<App />);
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Plain React client-side render | High (builds DOM after JS loads) | Multiple (JS triggers layout) | High (delayed paint) | [X] Bad |
| Next.js server-side or static render | Low (HTML sent ready) | Single (initial layout) | Low (fast paint) | [OK] Good |