T
TanStack16mo ago
harsh-harlequin

is useQuery better than useInfiniteQuery for Infinite scroll table serverside search,filter etc.?

I see useInfiniteQuery basically just keeps the previous data and you request next page, but when you do serverside search-sort-filtering, you of course do the last page search-sort-filtering, because you only know the lastPage, isn't useQuery basically better in this case with some adjustments on serverside? at least it doesn't duplicate items that way. or what i'm a missing?
2 Replies
harsh-harlequin
harsh-harlequinOP16mo ago
can anyone point out if i miss any logic here? first time using useInfiniteQuery, i did read the doc a lot too
ratty-blush
ratty-blush15mo ago
From what I know, useInfiniteQuery is build on top of useQuery. It provides you additional helper fn/states to work with feature like infinite Scrolling. Eventhough you can useQuery to achieve the same thing, you just have to implement bunch of stuff yourself

Did you find this page helpful?