Type error when using useInfiniteQuery
That's the type error I am getting.
I am using trpc with nextjs
This is the query I am making:
This is how it's handled on the trpc router:
8 Replies
remove the cursor argument
I need it tho
it will be generated with getNextPageParam
ehh
I need it inside of the trpc router also
It's the pageNumber
you don't need useInfiniteQuery then, just useQuery
but,
pagination
there is a load more button
next to cursor, I want to pass trough more arguments
I think cursor get's added automatically... YOu trigger reloads on top/bottom of the data stored behind the hook and the cursor is kept automatically since "useInfiniteQuery" does that for you.
You can manually provide a cursor/page upon fetching in the "fetchNextPage" call but that is completely optionally since the hook stores the amount and index of pages it retained
is the cursor gets passed through automaticlly then how do I access it in my trpc router.
I have found a solution
I just use cookies to fetch the location and pass the cursor through normally