1

Hello I am struggling to implement infinite scroll from last few days. I used django rest for building my api. Here is my pagination url https://example.com/blog-api/?page=1it will show 2 items per page. Here here my code

const fetchMoreData = async () => {
    let url = `https://backendapi.farhyn.com/blog-api/?page=${count + 1}`;
    SetCount(count + 1);
    const res = await fetch(url);

    const data = await res.json();
    SetBlog(data)
    console.log(data);
  };

 <InfiniteScroll
      dataLength={blog.results.length}
      next={fetchMoreData}
     hasMore={true}
    loader={<h4>Loading...</h4>}
 >{blog.results.map((data) => ( {data.blog_title}   ))}
 </InfiniteScroll>

where I am doing mistake? data not loading on scroll.

hawaj
  • 296
  • 3
  • 12
  • Does this answer your question? [How to implement infinite scroll in next js?](https://stackoverflow.com/questions/67624601/how-to-implement-infinite-scroll-in-next-js) – CptSosen Jun 19 '22 at 13:57

0 Answers0