diff --git a/src/pages/posts/PostsPage.js b/src/pages/posts/PostsPage.js index 11795dc..86b1061 100644 --- a/src/pages/posts/PostsPage.js +++ b/src/pages/posts/PostsPage.js @@ -13,6 +13,8 @@ import { useLocation } from "react-router-dom"; import { axiosReq } from "../../api/axiosDefaults"; import NoResults from "../../assets/no-results.png"; +import InfiniteScroll from "react-infinite-scroll-component"; +import {fetchMoreData} from "../../utils/utils" function PostsPage({ message, filter = "" }) { const [posts, setPosts] = useState({ results: [] }); @@ -60,9 +62,18 @@ function PostsPage({ message, filter = "" }) { {hasLoaded ? ( <> {posts.results.length ? ( - posts.results.map((post) => ( - - )) + ( + + )) + } + dataLength={posts.results.length} + loader={} + hasMore={!!posts.next} + next={() => fetchMoreData(posts, setPosts)} + /> + ) : (