#httpsbeta nextjs orgdocsroutingdefining
1 messages ยท Page 1 of 1 (latest)
yeah
lol but why is the nav bar under the page content
how does the layout.tsx look like
import Head from "../Head";
export default function RootLayout({
// Layouts must accept a children prop.
// This will be populated with nested layouts or pages
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<Head />
<h1>This is a nav bar</h1>
<body>{children}</body>
</html>
);
}
``` this is in the (withNav)/layout
remove app/layout.tsx
ah yes
do you know why this comes up?
it renders the items correctly
how you get the error?
when going to the index page
remove the <Head /> here
removed - same error
put h1 inside the body tag
thats my page.tsx file ``` export default function Page() {
return <div className="text-red-500 text-2xl"> Dashbord </div>;
}
ah so everything needs to go in the body tag
yes
even my navbar?
oh thank you! this helped so much ๐
just a quick question whats the alternative of using group layouts with the normal page directory to get the same effect? as getting to many errors when trying the app directory ๐ฆ
either put the navbar in every page or turn the layout to client component and only render the page except /login with usePathname hook
what do you mean by getting many errors?
getting errors regarding must use-client and then when I do that it cannot find my component ... Think i'll just use normal pages as i'm new to next getting a bit confused xD
well those error not related to route group
yeah I know but route grouping is not available without using the app dir right?