Performance: What is Next.js
Next.js affects page load speed and rendering performance by optimizing server-side rendering and static generation.
import React from 'react'; export default function Page() { return <div>Hello World</div>; } // Next.js pre-renders this page on server or at build time
import React from 'react'; export default function App() { return <div>Hello World</div>; } // Rendered only on client side
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Client-side React only | Many on client after JS loads | Multiple reflows during hydration | High paint cost due to delayed content | [X] Bad |
| Next.js pre-rendered page | Minimal on client at load | Single reflow on initial paint | Low paint cost with fast content display | [OK] Good |
pages folder where each file is a React component representing a page.pages folder matches this pattern; others describe static or manual routing methods not used in Next.js.pages folder -> Option Cpages folder [OK]about.js inside the pages folder?pages folder to URLs matching the filename.about.jsabout.js becomes accessible at /about without extra setup./about automatically -> Option Apages/contact.js but visiting /contact shows a 404 error. What is the likely mistake?Pass the test and this pattern moves unknown