TanStackT
TanStack14mo ago
6 replies
skinny-azure

data always returns the last api response

Hello everyone! data always returns the last api response. Is it possible to get only fresh response from data. In case of api failure or ongoing request, data return null ?
const {refetch, isFetching, data, error, isSuccess} = useQuery({
queryKey: ['todos'],
queryFn: query,
staleTime: 0,
enabled: true,
});
Was this page helpful?