Next.js Discord

Discord Forum

Optional catch all segment with parallel routes

Unanswered
Tonkinese posted this in #help-forum
Open in Discord
TonkineseOP
I have a UI that renders parallel routes. On the left is a list of items that is rendered by items/page.tsx, and on the right is details about the item, rendered by items/@details/page.tsx

I would like to be able to have the itemId in the URL, so that when you visit /items/validItemId, there is an item selected, and all other instances there is no item selected.


I tried the following layout:

items
|
[[...itemId]]
|
| ---------- @details
| |-------- page.tsx
|----------- page.tsx


but it gave errors.

Any idea how I can achieve what I want?

0 Replies