when i use the <link> component to go to a page it works fine but when i use the direct link of the page the whole page collapses as is seen in the image how to keep the page from collapsing and maintain consistent behavoiur
im still learning nextjs please be kind
#help needed routing/linking
35 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
what does your layout.tsx look like for this page
the parent layout which is correct or the child layout which gives me the error
the layout.tsx you have in the folder /blog
export default function RootLayout({children}: {children: any }) {
return (
<div>
{children}
</div>
);
}
this
and now the one for /
ive been stuck for 2hrs ```
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body>
<Container >{children}</Container>
</body>
</html>
);
}
function Container({children}:{children : any})
{
return (
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{children}
</ThemeProvider>
)
}
and page.tsx that contains the Link component?
return(
<Suspense fallback={<Skeleton className="w-[100px] h-[20px] rounded-full" /> }><>
<App className="absolute left-0 !float-left"/>
<Head/>
<Link href="/blog" prefetch={false} >blog</Link>
<ModeToggle ></ModeToggle>
{/* < Darkmodetoggle> */}
</></Suspense>
)
}
the page also renders collapsed if i reload after ive reached /blog
if you don’t have any other CSS that’s what it’s supposed to look like
idk why it shows up centered to begin with
ive been googling and chagpting this stuff and either im deep in SSR CSR rabbit hole or im just missing a else somewhere
might be inheriting shit from your / page
the parent or child page ?
yes
yes?
oh mb i get it
but how would taht work
nextjs doesnt cascade page.tsx right its just for layout.tsx
yeah that’s what I thought but your browser might be doing funky stuff
ive tried all browsers edge chrome firefox
try using incognito and seeing if that behaves differently
its the same behavoiur ive tried