TanStackT
TanStack14mo ago
7 replies
clean-aquamarine

Avoiding duplicate requests

I am using React Query to query an API for a list of members. The API returns a list of elements, one for each member. I use the list of member IDs as the query key.
Imagine that I query members 1, 2, and 3. The response is successful, and now I have their data.
I want to be able to query only members 1 and 2 (or only member 1) and use the same data as those queried in the first request. How can I do that?
Was this page helpful?