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=1
it 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.