useInfiniteQuery vs useQuery #1972
-
Relatively new to useQuery and just had a couple "appropriate use" Qs that I didn't see obvious answers to in the Discussions. A bit of context. I am accessing a paginated API with a tokenized next page URI that must be passed to grab the next page (as opposed to a simple I have this working with
A little more context. The fetched data is ultimately being rendered by an In this case, the data I need from the API is located in it's own array. So, to correctly populate the table, I'm consolidating the multiple "arrays within pages" using
Something about the way I've opted to solve this feels weird to me ... Any comments welcome. Thanks, Dirk |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
you could always paginate "manually" with
you can always do a custom hook and return the data in the structure that you prefer. perfectly fine to flatten out the array of pages on that level. |
Beta Was this translation helpful? Give feedback.
you could always paginate "manually" with
useQuery
andkeepPreviousData
. if your query data contains the "link" to the next page, it should be as simple as:you can always do a custom hook and return the da…