Complete the code to define a basic layout component in Next.js.
export default function Layout({ children }) {
return <div [1]>{children}</div>;
}The layout wraps children with a div that has padding using inline style.
Complete the code to create a nested layout by importing and using a parent layout.
import ParentLayout from './ParentLayout'; export default function ChildLayout({ children }) { return ( <ParentLayout> <section [1]>{children}</section> </ParentLayout> ); }
The child layout adds a class name to the section wrapping children inside the parent layout.
Fix the error in the nested layout by completing the code to correctly pass children.
export default function DashboardLayout({ children }) {
return (
<div className="dashboard">
[1]
</div>
);
}The children prop must be used exactly as passed to render nested content inside the main element.
Fill both blanks to create a nested layout that includes a header and footer around children.
export default function SiteLayout({ children }) {
return (
<div className="site-layout">
[1]
{children}
[2]
</div>
);
}The layout wraps children with a header above and a footer below for consistent site structure.
Fill all three blanks to create a nested layout with a sidebar, main content, and a footer.
export default function DashboardLayout({ children }) {
return (
<div className="dashboard-layout">
[1]
<main [2]>{children}</main>
[3]
</div>
);
}The layout includes a sidebar component, main content area with a class, and a footer component for full dashboard structure.