Add useRouteParams
and useRouteQuery
natively
#2446
maximepvrt
started this conversation in
Ideas
Replies: 1 comment
-
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.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
route
object to retrieveroute.query
androute.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
useRouteQuery
anduseRouteParams
to 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 theroute
object.Reference: @posva comment nuxt/nuxt#24788 (comment)
Describe alternatives you've considered
No response
Beta Was this translation helpful? Give feedback.
All reactions