T
TanStack15mo ago
harsh-harlequin

How to get a dynamic route path without the dynamic part?

What I mean by that is, how can I get something like "users/$userId" and not "users/123"?
3 Replies
deep-jade
deep-jade15mo ago
what does this mean? do you want to have a dollar sign in the url?
harsh-harlequin
harsh-harlequinOP15mo ago
If I have a users.$userId.tsx file, it would resolve to something like "users/123" And when I call router.pathname, I get back "users/123", instead of that I want to get "users/$userId". Basically, the argument you would pass to createFileRoute. I want to get it in the browser.
deep-jade
deep-jade15mo ago
Route.id is what you are looking for

Did you find this page helpful?