T
TanStack2y ago
stormy-gold

What is the recommended way to trigger a GET just once on button press?

I have a GET call that I want to trigger only once when the users clicks on a button, is there a recommended way to use useQuery so I can benefit from the loading/error handling?
3 Replies
stormy-gold
stormy-goldOP2y ago
After some researches I think the most reasonable way is to set enabled: false to useQuery and then manually call it with refetch, does that make sense?
vicious-gold
vicious-gold2y ago
Yeah that’s fine
stormy-gold
stormy-goldOP2y ago
Thanks 🙂

Did you find this page helpful?