Content Deep Dive
Tutorial: Pagination
Blog post from Apollo
Post Details
Company
Date Published
Author
Ramya Nagarajan
Word Count
1,963
Language
English
Hacker News Points
-
Source URL
Summary
This tutorial covers the implementation of cursor-based pagination in a React + GraphQL application. The server's schema is updated to expose an API for loading smaller chunks of data, and the client-side code is modified to use this new API. A new resolver is added to fetch messages from the server using cursors, which allows the client to load only a page's worth of data at once. The Apollo Client cache is also updated to handle the new message feed structure. Finally, a `fetchMore` function is implemented to load older messages when the "Load Older Messages" button is clicked, demonstrating cursor-based pagination in practice.