How to execute query based on click event?? #1656
-
How can I be able to make a query request to the server when someone clicks let's say a button?? |
Beta Was this translation helpful? Give feedback.
Answered by
JoviDeCroock
May 20, 2021
Replies: 1 comment 4 replies
-
const MyComponent = () => {
const [result, execute] = useQuery({ query: yourQuery, pause: true });
const onlick = () => {
// You can pass in context here, example requestPlicy
execute({ requestPolicy: 'network-only' })
}
}
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
JoviDeCroock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pause
is used to not automatically fire as mentioned in the docs