Performance: Root layout (required)
HIGH IMPACT
The root layout affects the initial page load speed and visual stability by defining the main structure and shared UI elements that load on every page.
export default function RootLayout({ children }) { return ( <html lang="en"> <body> <Header /> {children} </body> </html> ) }
export default function RootLayout({ children }) { return ( <html lang="en"> <body> <Header /> <HeavyComponent /> {children} </body> </html> ) }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy components in root layout | High (many nodes) | Multiple reflows | High paint cost | [X] Bad |
| Minimal static root layout | Low (few nodes) | Single reflow | Low paint cost | [OK] Good |