Loading older todos
It might not be always ideal to load all the todos in the database. You would want to have some kind of pagination to enforce fetching data incrementally.
In this app, we will implement the basic functionality of loading older todos on a button click.
The ideal workflow to implement this feature would be:
- Start with loading only "n" items
- On "load more", fetch "n" more items older than the oldest local item
- Append the newly loaded items to apollo cache
You will learn:
- Ideas behind implementing pagination in GraphQL
- To update apollo cache whenever required
Lets do it.
Did you find this page helpful?
Start with GraphQL on Hasura for Free
- Build apps and APIs 10x faster
- Built-in authorization and caching
- 8x more performant than hand-rolled APIs