Vue query syntax without destructuring #7356
Replies: 2 comments
-
Just wanted to say thank you for making this post. I couldn't figure out why I couldn't use the query without destructuring until I found this. I agree, it's quite confusing and if there's any way possible to resolve this it would be a great addition. |
Beta Was this translation helpful? Give feedback.
-
Another one thanking this question as it was the only hint to use the results of @TkDodo , the documentation is not very clear about the fact that when you don't destructure the return of |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to access the values returned by
useQuery
in Vue without resorting to destructuring and without needing to use.value
in the template?Example of what I'm doing right now, which requires
.value
in the template:script:
template:
I know I could use destructuring and access data, isFetching and error individually. But in a component with multiple queries, this is impracticable because of name collisions. And renaming each of these values with something like isFetchingParametrization, errorParametrization, dataParametrization... would not be a good syntax and is too verbose.
So the best solution is a wrapper object and it makes more sense semantically, but the need of
.value
inside the template is annoying and discordant from the rest of the usual reactive code. There's any way to fix that?Beta Was this translation helpful? Give feedback.
All reactions