Refetch data on error
Hey, on Error I want to render a toast with a button that will refetch my query.
In v4 I could add
onError
callback to useQuery
, call my toast method there and pass it a refetch
method to a button onClick callback.
In v5 there is a global onError
callback for QueryCache
instance, but I don't know how can I refetch my query there as I have no access to refetch
method.2 Replies
like-gold•2y ago
with queryClient.refetchQueries
equal-aquaOP•2y ago
Thank you!