implement polling in react with useQuery
I want to implement a polling query in react, but i want the query to stop re-fetching as soon as the expected data hits the app
It's more like re-fetching until the data has been defined (for context, I'm using it to verify solana pay transactions https://solanapay.com/
What's the best way to do this?
3 Replies
wise-whiteOP•3y ago
I can just add a
refetchInterval to implement re-fetching after intervals
But how to stop the fetch after data is in a certain format (perhaps after parsing with zod)complex-teal•3y ago
refetchInterval can be a function which gets the latest data passed. return false to stop pollingwise-whiteOP•3y ago
thanks for the help, works!
btw I loved your blog series on react query, it was pretty good :Salute: