How to do it
- Limit-Offset: Request a specific chunk of the list by providing the indices of the items to be retrieved (in fact, you’re mostly providing the start index (offset) as well as a count of items to be retrieved (limit)).
- Cursor-based (Edges): This pagination model is a bit more advanced. Every element in the list is associated with a unique ID (the cursor). Clients paginating through the list then provide the cursor of the starting element as well as a count of items to be retrieved.
Using edges and nodes pagination allows the client to retrieve the data in chunks, rather than having to retrieve the entire list of items at once.
This can help to improve performance, especially when the list of items is large or when the data is being retrieved over a slow connection.
type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}