How to use useQuery from inside of a function? #1359
martinszeltins
started this conversation in
General
Replies: 1 comment 2 replies
-
Check out of the docs for useLazyQuery: https://v4.apollo.vuejs.org/guide-composable/query.html#lazy-query Basically:
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can I use
useQuery
from inside of a function and still have access toresult
andloading
in my template? For example here I do not have access toresults
orloading
from my template because they are defined withing theloadData
function and I need to load the data only when the user clicks the button.Also, ideally, I want to move my
useQuery
to a different file likeusersApi.js
and then callusersApi.getUsers()
Beta Was this translation helpful? Give feedback.
All reactions