Having a Slug instead of id in the route url
Hi i wanted to know if it's possible to have a slug instead of the id in the url but get the id in the params to make some call in the loader. Something like this :
url :
in the code :
And in the route :
Thank you for your help
3 Replies
eager-peach•16mo ago
where should the id be stored?
as a path param or as a query param?
automatic-azureOP•16mo ago
as a query params
eager-peach•16mo ago
please check the documentation:
https://tanstack.com/router/v1/docs/framework/react/guide/search-params
Search Params | TanStack Router React Docs
Similar to how TanStack Query made handling server-state in your React applications a breeze, TanStack Router aims to unlock the power of URL search params in your applications.
Why not just use URLSearchParams?