Add useRouteParams and useRouteQuery natively
#2446
Replies: 2 comments
-
|
Since that comment some things haven't changed, e.g. an RFC would help to gather feedback 😄 . Others have changed: there are plans to expose some compososables like |
Beta Was this translation helpful? Give feedback.
-
|
What's cumbersome to me isn't accessing route properties through TL;DR: In my opinion, Currently, accessing
Given that query parameters can have multiple values (analogous to
All three changes are breaking changes so this is largely just a wishlist of mine that I |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What problem is this solving
The current approach for accessing route queries and parameters in vue-router is not very developer-friendly. Developers must manually access the
routeobject to retrieveroute.queryandroute.params, which is cumbersome and decreases the developer experience (DX). Having dedicated composables would improve the ergonomics and make the API more intuitive.Proposed solution
Add composables
useRouteQueryanduseRouteParamsto vue-router, similar to the ones available in vueUse. This would simplify and enhance the DX by allowing developers to access query and params directly in a reactive way, without needing to manually work with therouteobject.Reference: @posva comment nuxt/nuxt#24788 (comment)
Describe alternatives you've considered
No response
Beta Was this translation helpful? Give feedback.
All reactions