-
-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use localePath() with route params? #3004
Comments
We should document this better, my recommendation would be to use an object with the route name I think passing paths works with certain configurations but as you have noticed it won't when using |
I always try to avoid using route names because they are hard to find and sometimes I just cant find the right one at all |
I agree they're a bit hidden, I used to check devtools often to make sure I had the correct route name. But currently it's the most reliable way to retrieve routes regardless of i18n configuration, as the route name remains (essentially) the same across languages while the route path does not due to localization, prefix strategy, parameters and encoding. You can also set a custom route name using |
I use custom route paths per language, e.g. This is why I tried to avoid path names, but in this case I have to use them. How can I use them with custom route paths? E.g. I have the following file structure:
Which I map to:
|
I think I got it:
|
I have just published the first release candidate for v9 which includes the experimental typed routes Try it out and please open new issues if you experience any with this feature 🙏 |
Sounds amazing, I will check soon!! |
I tried it and it is super cool, finally autocompletion for route paths!! :) However @BobbieGoede I would add at least one example with
|
Thanks for trying it out! I agree we still need to add that somewhere in the docs, just not sure where 😂 Feel free to open a PR, reopening this issue to track the documentation issue. |
Unfortunately the docs doesnt show how to use
localePath()
with route params. E.g.:How to do link to such a page? I tried
localePath('products/' + id)
with no success.The text was updated successfully, but these errors were encountered: