diff --git a/examples/react/pagination/pages/index.js b/examples/react/pagination/pages/index.js index 7d0a4436f4..1e77844f40 100644 --- a/examples/react/pagination/pages/index.js +++ b/examples/react/pagination/pages/index.js @@ -35,12 +35,12 @@ function Example() { // Prefetch the next page! React.useEffect(() => { - if (data?.hasMore) { + if (!isPreviousData && data?.hasMore) { queryClient.prefetchQuery(['projects', page + 1], () => fetchProjects(page + 1), ) } - }, [data, page, queryClient]) + }, [data, isPreviousData, page, queryClient]) return (