Recommended Path Segment
Lets say I have the following routes
-
hello
- hello/foo
- hello/bar
- hello/fee
In the hello component I need to get the last path segment: [undefined] | foo | bar | fee (undefined is for the first route). Is there a recommended way to do this ?
Is the following the recommended way?:
I was wondering if there was something like:
Note: I have a typescript tag on this post because matchRoute's to doesn't like hello/$lastsegment since a path parameter route doesnt exist (hello/$lastSegment).2 Replies
unwilling-turquoise•15mo ago
you could use this:
https://stackblitz.com/edit/tanstack-router-tdtxnt?file=src%2Froutes%2Fhello.tsx&preset=node
StackBlitz
Router Quickstart File Based Example (forked) - StackBlitz
Run official live example code for Router Quickstart File Based, created by Tanstack on StackBlitz
unwilling-turquoise•15mo ago