This example demonstrates ways you can paginate GraphCMS queries.
- Generate numbered pages. This example generates a number of static pages based on a total count and a 'per page' limit.
- Larger result sets. GraphCMS has a default result set size of 100 entries, which can be increased up to 1000 entries. This example using a
for await
statement to 'loop' requests until all data matching the desired query is returned.
This example is built with Next.js and graphql-request
.
• Demo
npx degit graphcms/graphcms-examples/using-pagination using-pagination
Install & Run:
cd using-pagination
npm install
npm run dev
# or
cd using-pagination
yarn
yarn dev