Next.js Discord

Discord Forum

layout is not working for some reason

Answered
Asian black bear posted this in #help-forum
Open in Discord
Asian black bearOP
I have layout in the root folder
(layout.tsx)
import '@/app/ui/global.css';
import { inter } from '@/app/ui/fonts';
export default function RootLayout({children}: {children: React.ReactNode;}) {
  return (
    <html lang="en">
          <body className={`${inter.className} antialiased`}>{children}</body>
    </html>
  );
}


and another layout inside folder "dashboard"
(layout.js)

export default function DashboardLayout({children,}:{children:React.ReactNode}){

    return(<div>children</div>);
}


I keep getting error on dashboard's layout on : saying Expected ',', got ':'

what does that means ?? its part of a tutorial so Im not sure what went wrong
Answered by chisto
your file is js, and you are using typescript, either change it to .ts
or delete the second part :{children:React.ReactNode}
View full answer

6 Replies

theres a , on your {children,}
export default function DashboardLayout({children,}:{children:React.ReactNode}){

    return(<div>children</div>);
}
you just have to remove it
{children,}:{children:React.ReactNode}

to
{children}:{children:React.ReactNode}
@chisto you just have to remove it {children,}:{children:React.ReactNode} to {children}:{children:React.ReactNode}
Asian black bearOP
not the issue , i m still getting the errro
your file is js, and you are using typescript, either change it to .ts
or delete the second part :{children:React.ReactNode}
Answer