const {
data,
isFetching,
isLoading,
fetchPreviousPage,
isFetchingPreviousPage,
fetchNextPage,
isFetchingNextPage,
} = useInfiniteQuery({
queryKey: ['tableData', pagination],
queryFn: async ({ pageParam = pagination }) => {
const response: ApiResponse<T> = await fetch(
resourceUrl + `?offset=${pageParam.offset}&limit=${pageParam.limit}`,
).then((res) => res.json());
return response;
},
keepPreviousData: true,
refetchOnWindowFocus: false,
});
const {
data,
isFetching,
isLoading,
fetchPreviousPage,
isFetchingPreviousPage,
fetchNextPage,
isFetchingNextPage,
} = useInfiniteQuery({
queryKey: ['tableData', pagination],
queryFn: async ({ pageParam = pagination }) => {
const response: ApiResponse<T> = await fetch(
resourceUrl + `?offset=${pageParam.offset}&limit=${pageParam.limit}`,
).then((res) => res.json());
return response;
},
keepPreviousData: true,
refetchOnWindowFocus: false,
});