diff --git a/components/common/MyInfiniteScroller.tsx b/components/common/MyInfiniteScroller.tsx index 4b20e0508..b5b5ec507 100644 --- a/components/common/MyInfiniteScroller.tsx +++ b/components/common/MyInfiniteScroller.tsx @@ -5,8 +5,10 @@ import { Flex } from "@chakra-ui/react"; import { ReactElement, ReactNodeArray, useState } from "react"; import InfiniteScroll from "react-infinite-scroller"; +const ON_PAGE = 6; + const MyInfiniteScroller: React.FC = ({ children }) => { - const [elementsToShow, setElementsToShow] = useState(12); + const [elementsToShow, setElementsToShow] = useState(ON_PAGE); if (!Array.isArray(children)) throw Error("children for MyInfiniteScroller is not an array"); @@ -14,7 +16,7 @@ const MyInfiniteScroller: React.FC = ({ children }) => { return ( setElementsToShow(page * 12)} + loadMore={(page) => setElementsToShow(page * ON_PAGE)} hasMore={elementsToShow < children.length} >