please i need resource recommendation for pagination on trpc the official docs is very confusing
Please any recommendations will be much appreciated be it video or blog post or code snippet etc
21 Replies
can't i do pagination without the url changing?
like implementing infinite scroll
you can
the handlepagination on that was just my lazy way of doing that
oh
Infinite Queries | TanStack Query Docs
Rendering lists that can additively "load more" data onto an existing set of data or "infinite scroll" is also a very common UI pattern. React Query supports a useful version of useQuery called useInfiniteQuery for querying these types of lists.
When using useInfiniteQuery, you'll notice a few things are different:
thanks
lastly
the skip and take are the what confused me in the offical doc
not the init pagination but the handling next page
if you are on the first page
you would skip the first 10 rows
page and limit for init then skip for next page?
so you will skip the previous pages you have before?
kind of
with offset pagination you have that
why pagination1 and pagination2?
two methods
cant have a single function?
to show the difference between the
page - 1
i am still lost thou
let me make a better example
okay thanks
basically
on the first page you do not want to skip the first N rows from the table
So basically i will need 2 functions for pagination on the client side?
Because of handling the skip logic?
no
you just need one
i was just showing about the
page-1