Loading on demand ... infinite scroll
See original GitHub issueI realize loading on demand and infinite scrolling is not part of this components job and that this issue has been raised several times before. The author wants the component to be agnostic of how to load data on demand via an infinite scroll - and that is perfectly reasonable.
The author kindly showed some example code in issue https://github.com/orgsync/react-list/issues/24 that shows a parent FetchList component that renders a child react-list component. The part I’m struggling with is how to trigger a further load. The author mentions setting the length
property to the loaded items length + 1
. Which is all fine and appears to work for an initial load of data. But how can I subsequently set that - I can’t call setState
from the parent FetchList
itemRender
method because that’s called from render
.
If anyone could help point me in the right direction here I would be deeply grateful. I’ve been struggling with this for some time now.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top GitHub Comments
I’ve simulated the AJAX call by just using a
setTimeout
and I now get infinite scrolling!.This is the completed code of my prototype in case it helps others.
Many thanks to caseywebdev for his help in resolving my issues here.
That’s making sense now. I’ll go away and plug the ajax bit in. Many thanks once again.