ezalorsara
ezalorsara2y ago

pagination - Offset Method

Hi trpc has pagination example but only using cursor https://trpc.io/docs/reactjs/useinfinitequery Is there an example there that use offset pagination https://www.prisma.io/docs/concepts/components/prisma-client/pagination Or is it not supported by trpc useInfiniteQuery. Thank you
useInfiniteQuery | tRPC
- Your procedure needs to accept a cursor input of any type (string, number, etc) to expose this hook.
Prisma
Pagination (Reference)
Prisma Client supports both offset pagination and cursor-based pagination. Learn more about the pros and cons of different pagination approaches and how to implement them.
2 Replies
Alex / KATT 🐱
we wouldn't use useInfiniteQuery then i think
Alex / KATT 🐱
Paginated / Lagged Queries | TanStack Query Docs
Rendering paginated data is a very common UI pattern and in TanStack Query, it "just works" by including the page information in the query key: