T
TanStack2y ago
rare-sapphire

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
rare-sapphire
rare-sapphireOP2y 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?
jolly-crimson
jolly-crimson2y ago
Yeah that’s fine
rare-sapphire
rare-sapphireOP2y ago
Thanks 🙂

Did you find this page helpful?