Next.js Discord

Discord Forum

params is missing slug is not coming inside layout

Unanswered
Giant Chinchilla posted this in #help-forum
Open in Discord
Avatar
Giant ChinchillaOP
export default function ShopLayout({
children,
params,
}: {
children: React.ReactNode
params: {
id: string
}
}) {
console.log(params)
return <InboxLayout>{children}</InboxLayout>
}

12 Replies

Avatar
@Alfonsus Ardani what does `console.log("Params:", params)` says?
Avatar
Giant ChinchillaOP
it returning empty object and pathname of file is http://localhost:3000/inbox/67572500af76e13824983888
slug id 67572500af76e13824983888 is missing in props..
Avatar
Giant ChinchillaOP
@Alfonsus Ardani apps/web/src/app/(dashboard)/(app)/inbox/layout.tsx
Avatar
i see the problem now
you can't get the params that is on the child path segment
Avatar
Giant ChinchillaOP
tried but able to solve with const { id } = useParams(); but still i want to know why it not autopass ?
either you detect with useparams or use parallel routes