xxxxxxxxxx
// We can alter this behavior in a few ways. For example, we can use the pollingInterval property to allow the query to refresh automatically.
const { data, isLoading, isError } = useGetPhotoByIdQuery(photoId, {
pollingInterval: 60_000 // 1 minute
});
//We can also use the refetchOnMountOrArgChange flag to skip the cached result.
useGetPhotoByIdQuery(photoId, {
refetchOnMountOrArgChange: true
});
// to remove cache query data on onQueryStarted
dispatch( apiSlice.util.invalidateTags(['branchList']));