Parallel Routes are weird to understand
Answered
Ninhache posted this in #help-forum
NinhacheOP
Hi !
I try to use parallel routes for the first time and It's a pain a bit !
Here's a part of my directories in a tree-like format :
Main problems are the following :
And I cannot figure how to solve my problems, I cannot understand why is it failing
-> visiting
-> so, visiting thanks to the redirect (on
-> visiting
I try to use parallel routes for the first time and It's a pain a bit !
Here's a part of my directories in a tree-like format :
[id]
├── @items
│ ├── layout.tsx
│ └── page.tsx
├── @nav
│ ├── enchant
│ │ └── page.tsx
│ ├── items
│ │ └── page.tsx
│ │
│ └── spells
│ │ └── page.tsx
│ ├── layout.tsx
│ └── page.tsx
├── layout.tsx
└── page.tsx
Main problems are the following :
And I cannot figure how to solve my problems, I cannot understand why is it failing
-> visiting
/[id]/
returns correct things but the right menu isnt correct to me, i need something to visit, the only that comes to my head is to add a redirect in the /[id]/@nav/page.tsx
that will redirect to /[id]/items
-> so, visiting thanks to the redirect (on
/[id]/items
), Im getting 404, maybe due to the missing /[id]/@items/items/page.tsx
, so, I created it, but still the same..-> visiting
/[id]/items
without the redirect is the same thoAnswered by Ninhache
i just basically copy/paste the [parallel-route's code](https://github.com/vercel/next-app-router-playground/tree/main/app/parallel-routes) from vercel
and it's working.. here's my new files :
and it's working.. here's my new files :
├── @nav
│ ├── enchant
│ │ └── page.tsx
│ └── spells
│ └── page.tsx
│ ├── default.tsx
│ ├── layout.tsx
│ └── page.tsx
├── default.tsx
├── not-found.tsx
├── layout.tsx
└── page.tsx
I removed @items, it wasnt usefull and, since I always need it, I place the page's code in the [id]/page.tsx
instead
10 Replies
try adding a default.tsx inside [id] to avoid the 404's
export default function Default() {
return null
}
export default function Default() {
return null
}
NinhacheOP
Didnt solve it
Still a 404 :/
what url gives u 404?
NinhacheOP
with the redirect
/builder/[id]/
"auto" route to /builder/[id]/items
that gives 404NinhacheOP
that redirect isnt a good idea maybe
NinhacheOP
i just basically copy/paste the [parallel-route's code](https://github.com/vercel/next-app-router-playground/tree/main/app/parallel-routes) from vercel
and it's working.. here's my new files :
and it's working.. here's my new files :
├── @nav
│ ├── enchant
│ │ └── page.tsx
│ └── spells
│ └── page.tsx
│ ├── default.tsx
│ ├── layout.tsx
│ └── page.tsx
├── default.tsx
├── not-found.tsx
├── layout.tsx
└── page.tsx
I removed @items, it wasnt usefull and, since I always need it, I place the page's code in the [id]/page.tsx
instead
Answer
so its not parallel anymore? why not just (nav) instead of @nav
NinhacheOP
I maybe didnt well understand when to use parallele :/
I needed something to change only a part of my app
in my case, that was about a specific component
in my case, that was about a specific component