load more function is not getting invoked!
See original GitHub issueLoad More function is not getting invoked when scroll to down *Expected to see “loaded!”’ two three times but not, please help me
loadMoreBooks = async () => {
console.log('loaded!');
const data = await db.collection('books').get();
let books = this.state.books;
data.forEach(book => {
books = [...books, { id: book.id, ...book.data() }];
});
this.setState({ books });
};
// Render Method
<InfiniteScroll
pageStart={0}
loadMore={this.loadMoreBooks}
hasMore={hasMoreBooks}
loader={
<div className="loader" key={0}>
Loading ...
</div>
}
>
<Tiles maxCount={4}>{bookList}</Tiles>
</InfiniteScroll>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:19
Top Results From Across the Web
“react-infinite-scroll-component” Stopped working after one ...
I had this issue. It turns out I was using dataLength in the wrong way. I thought it was supposed to be the...
Read more >Load more functionality in ReactJS - Level Up Coding
In this article, we are going to look at a form of pagination that involves using a load more button, that when clicked...
Read more >JavaScript Function Invocation - W3Schools
This is a common way to invoke a JavaScript function, but not a very good practice. Global variables, methods, or functions can easily...
Read more >Passing Functions to Components - React
Pass event handlers and other functions as props to child components: ... Throttling prevents a function from being called more than once in...
Read more >Best practices for working with AWS Lambda functions
This allows you to make a more unit-testable function. ... make sure the value of the function's expected invocation time does not exceed...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I found the point.
<InfiniteScroll><YourScrollDiv> other children ... </YourScrollDiv></InfiniteScroll>
If any upper element has ‘overflow: auto;’ defined, it means that scroll area is not window anymore:
<InfiniteScroll ... getScrollParent={()=>document.getElementById('el-which-has-overflow-defined')} useWindow={false}>