Next.js Discord

Discord Forum

Header Rendering twice although it is only once

Answered
Marble gall posted this in #help-forum
Open in Discord
Marble gallOP
So I have a Header component which is being called in my layout.tsx, and when I go to /, it shows twice the header, I don't know why, because it's only once in the layout. Can someone tell me why this happens and how to fix it, please?

layout.tsx
import Header from '@/components/Header'

export default function Layout({ children }: { children: React.ReactNode }) {
    return (
        <html lang='es'>
            <body
                className={`${font.className} flex min-h-screen flex-col items-center bg-slate-200`}
            >
                <Header />
                {children}
            </body>
        </html>
    )
}


(The Header is just some HTML and 4 <Link> tags)
Answered by joulev
in that case dont do that
View full answer

6 Replies