I need to create a list with infinite scrolling. I would like to use Apollo Client Graphql Subscriptions and the Intersection Observer. Is there an example of how I can implement this in a React app?
Hi @shipswake I don’t know whether you’d need a subscription to successfully implement infinite scrolling. I think a regular pagination API would probably be the simplest way of achieving that. Essentially you’d use Intersection Observer to watch a “sentinel” <div>
at the bottom of the scroll container. Then when it’s visible, you call fetchMore
to grab the next X items in your paginated list.
If you can share more about your use case, maybe the case for subscriptions will be more clear