Parallel route slot rendering 404
Answered
Tomistoma posted this in #help-forum
TomistomaOP
My current folder structure setup is:
Inside the
If I navigate to
Is this a correct use of slots? If so, why does the 404 page show?
app/
├─ form/
│ ├─ @header/
│ │ ├─ page.tsx
│ ├─ begin/
│ │ ├─ page.tsx
│ ├─ layout.tsx
│ ├─ page.tsxInside the
layout.tsx of /form is:export default function Layout({
children,
header,
}: {
children: React.ReactNode;
header: React.ReactNode;
}) {
return (
<>
{header}
{children}
</>
);
}If I navigate to
/form/begin, I would expect the content of the begin page, as well as @header/page.tsx, but instead I breifly see an empty page and then the 404 page is shown. I may not be using the slots for the right thing, but in this case I would like to render 2 different headers across all pages depening on the progress of the form.Is this a correct use of slots? If so, why does the 404 page show?
Answered by joulev
I think you need either
form/@header/default.tsx or form/@header/begin/page.tsx4 Replies
I think you need either
form/@header/default.tsx or form/@header/begin/page.tsxAnswer
TomistomaOP
okay it was the former that was needed, thanks. I guess I dont understand slots as much as I thought I did. When would
page.tsx be rendered then?@Tomistoma okay it was the former that was needed, thanks. I guess I dont understand slots as much as I thought I did. When would `page.tsx` be rendered then?
@header/page.tsx is for the header in /form.@header/foo/bar/page.tsx is for the header in /form/foo/bar.@header/default.tsx is for the header that isn't matched by any other @header/**/page.tsx files (think of it as a not-found but for parallel slots.TomistomaOP
ohhh okay that makes a lot more sense, thanks!