Layouts
Root layout required
App/layout.tsx
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>
<main>{children}</main>
</body>
</html>
)
}Nested layout
Put layout.tsx in folder and it will apply to everything in the folder
app/dashboard/layout.tsx
Templates
Dont persist across routes and maintain state, templates create a new instance for each of their children on navigation, useful when:
To resynchronize
useEffecton navigation.To reset the state of a child Client Components on navigation.
app/template.tsx
Layouts still apply
Last updated