Question about route conflicts
Hello.
With file-based routing, how can I achieve:
/items
- $itemId.tsx
- new.tsx
new.tsx
seems to be conflicting with the param route5 Replies
extended-salmon•13mo ago
It shouldn't, just creating the following files should do the trick.
It gives you the following URLs.
- /items/$itemId
- /items/new
Your
/items/new
route won't conflict with the /items/$itemId
route since the sorting would first try to match it with the new
route before evaluvating it as the $itemId
param route.extended-salmon•13mo ago
If you are still having difficulties with this, please fork the Quickstart Stackblitz example to setup the kind of routing you are looking for.
https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart-file-based?file=src/main.tsx
StackBlitz
Router Quickstart File Based Example - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
national-goldOP•13mo ago
Huh, it works now with 0 changes
I guess the route gen had a hiccup
extended-salmon•13mo ago
¯\_(ツ)_/¯
national-goldOP•13mo ago
Thanks anyway