Ah sorry I wasn’t more clear… I was on mobile at the time
Just to clarify, by “component’s load callback,” do you mean the “componentDidMount” property in the React component?
So for this specific component it has a prop that takes a function. This function is called when you get near the end of the infinite list. Normally you would use AJAX to get more data but in Meteor we can just adjust the subscription to say ‘give me 10 additional posts’. This will make it re-render.
Actually now that i’m thinking about it… if a re-render screws up the list you could use a DDP method in place of an AJAX method. I wouldn’t do this unless you have to.
Anyhow the prop is called
onInfiniteLoad and the info on that can be found here
I’ve been translating this guide to React: https://gentlenode.com/journal/meteor-21-pagination-system-with-infinite-scroll/43
Here’s a Gist of what I’ve got so far:
This works great except for two things:
I get these errors in the console:
I’m not quite sure about this one. The tutorial is using Blaze so that’s going to be different than React.
If you need an app to tinker with I have a Facebook clone on github here: http://react-ive.meteor.com/feed It has a ‘load more’ button (not infinite-scroll) that can be augmented to do infinite scroll. This may be easier to get a sample working.