Skip to content

Commit f023881

Browse files
alikhani-devAlikhani
andauthored
docs: update fetchNextPage condition in Example component (#9626)
Co-authored-by: Alikhani <[email protected]>
1 parent f49cc75 commit f023881

File tree

1 file changed

+2
-2
lines changed
  • examples/react/load-more-infinite-scroll/src/pages

1 file changed

+2
-2
lines changed

examples/react/load-more-infinite-scroll/src/pages/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ function Example() {
5050
})
5151

5252
React.useEffect(() => {
53-
if (inView) {
53+
if (inView && hasNextPage && !isFetchingNextPage) {
5454
fetchNextPage()
5555
}
56-
}, [fetchNextPage, inView])
56+
}, [inView, hasNextPage, isFetchingNextPage, fetchNextPage])
5757

5858
return (
5959
<div>

0 commit comments

Comments
 (0)