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
rising-crimson•16mo 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.rising-crimson•16mo 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
conscious-sapphireOP•16mo ago
Huh, it works now with 0 changes
I guess the route gen had a hiccup
rising-crimson•16mo ago
¯\_(ツ)_/¯
conscious-sapphireOP•16mo ago
Thanks anyway