Next.js Discord

Discord Forum

Why Is Adding Div to the layout erroring

Answered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <div>Lol</div>
      <body className={inter.className}>{children}</body>
    </html>
  )
}
Answered by riský
you should add the div inside body
View full answer

4 Replies

you should add the div inside body
Answer
like:
export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">

      <body className={inter.className}>
        <div>Lol</div>
         {children}
      </body>
    </html>
  )
}
Asiatic LionOP
Oh shiiiii, thanks does this aply to the
<header></header> 
as well cause I was also getting the same issue
@Asiatic Lion yes that’s basic html, the content goes into the body