Performance: App directory (App Router)
This affects the page load speed and rendering performance by how Next.js organizes and loads routes and components.
app/
page.js
about/page.js
contact/page.js
layout.js
components/
Header.js
Footer.js
// Components and routes are loaded per route automaticallypages/
index.js
about.js
contact.js
components/
Header.js
Footer.js
// All components imported globally in _app.js| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Pages directory with global imports | High (all components loaded) | Multiple reflows due to large JS | High paint cost from large DOM | [X] Bad |
| App directory with route-based code splitting | Low (only route components) | Single reflow per route | Lower paint cost with smaller DOM | [OK] Good |
page.js file represent?page.js in App Routerpage.js file defines a route that users can visit.layout.js define layouts, not routes. API routes are in api/ folders, and static assets are in public/.layout.js file inside the folder representing the route._app.js file is used in the old pages router, not App Router. page.js defines pages, not layouts. server.js is unrelated.app/ directory:app/
layout.js
page.js
dashboard/
layout.js
page.js
/dashboard?app/dashboard/page.js:export default function DashboardPage() {
return Dashboard
}
/dashboard, you get a blank page. What is the most likely cause?layout.js file in the app/ directory is required to render any pages, including nested ones.page.js file name is correct, and the component is exported as default. Class components are not required./blog/[slug] using the App Router. Which folder and file structure is correct?[slug].[slug] contains a page.js file to render the dynamic route. Other options use incorrect naming or file placement.Pass the test and this pattern moves unknown