T
TanStack13mo ago
deep-jade

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
robust-apricot
robust-apricot13mo ago
what does this mean? do you want to have a dollar sign in the url?
deep-jade
deep-jadeOP13mo 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.
robust-apricot
robust-apricot13mo ago
Route.id is what you are looking for

Did you find this page helpful?