Refreshing Data After Deleting with useQuery Cache
Hi,
I’m using useQuery to cache my data, but I want to ensure that the data is refetched after performing a delete operation. Currently, when I reload the page, the data is stale due to caching. What is the best way to trigger a refetch of the data after deleting an item? Should I use queryClient.invalidateQueries or is there a better approach?
Thanks for your help!
I’m using useQuery to cache my data, but I want to ensure that the data is refetched after performing a delete operation. Currently, when I reload the page, the data is stale due to caching. What is the best way to trigger a refetch of the data after deleting an item? Should I use queryClient.invalidateQueries or is there a better approach?
Thanks for your help!