Next.js Discord

Discord Forum

Hydration error

Answered
Cimarrón Uruguayo posted this in #help-forum
Open in Discord
Avatar
Cimarrón UruguayoOP
import NavBar from '@/components/navbar'

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html>
      <NavBar />
      <body>{children}</body>
    </html>
  )
}


export default function Page() {
  return <>Home Page</>
}


export default function NavBar() {
  return <>Navbar</>
}


These are the only files, why am i still getting a hydration error?
Image
Answered by Cimarrón Uruguayo
moving <NavBar /> inside the body fixed it
View full answer

12 Replies

Avatar
Can you first try on icogonito?
I heard it happens due to extension sometimes
Avatar
Cimarrón UruguayoOP
nah
i think i found the issue
but idk why its the issue
Avatar
Cimarrón UruguayoOP
moving <NavBar /> inside the body fixed it
Answer
Avatar
Wait, Navbar is supposed to be inside body only
I didn't notice it
You can mark this as a solution
Avatar
Cimarrón UruguayoOP
why
Avatar
All Visual elements are supposed to be inside body
Avatar
Cimarrón UruguayoOP
thanks