Performance: Parallel routes (@slot)
Parallel routes with @slot affect how quickly multiple UI sections load and render simultaneously, improving perceived page speed and interaction readiness.
export default function Page({ sidebar, mainContent, footer }) { return ( <> {sidebar} {mainContent} {footer} </> ) }
export default function Page() { return ( <> <Sidebar /> <MainContent /> <Footer /> </> ) }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Sequential route loading | Single DOM tree built after all data loads | Multiple reflows as components mount sequentially | High paint cost due to delayed content | [X] Bad |
| Parallel routes with @slot | Multiple smaller DOM trees built independently | Fewer reflows as components render in parallel | Lower paint cost with faster visible content | [OK] Good |
@slot in Next.js parallel routes?@slot@slot is used to show multiple UI parts at once by matching route segments.sidebar in Next.js?export const sidebar.export const sidebar = () => <div>Sidebar</div>; correctly exports a constant named sidebar as a React component.export const header = () => <header>Header</header>;
export const footer = () => <footer>Footer</footer>;
export default function Page() {
return <main>Main Content</main>;
}header and footer render alongside the default export component.export const sidebar = () => <div>Sidebar</div>;
export default function Page() {
return <main>Main</main>;
}sidebar exists, the slot won't render.sidebar does not match any route segment -> Option Anav bar and a content area side by side. Which folder structure and code setup correctly implements this using @slot?nav and content.nav folder, export export const nav for the slot; in content folder, export default the main content.app/nav/page.tsx and app/content/page.tsx with export const nav = () => <nav>Nav</nav>; in nav folder and export default function Page() { return <main>Content</main>; } in content folder correctly uses folders app/nav and app/content with proper exports.Pass the test and this pattern moves unknown