Is it possible to distinguish the response, we get from useQueries. For example
const ids = ['dg1', 'pt3', 'bn5'];
const data = useQueries(
ids.map(id => (
{
queryKey: ['friends', id],
queryFn: () => get(
'/v3/friends',
{
query: {
id,
},
},
),
}
)),
);
from the response, how can I know which response is for id dg1 and so forth or is the of the responses guaranteed to be in the same order as the ids?
The order returned from useQueries is the same as the input order, so in your example:
data[0] will be for id: 'dg1'data[1] will be for id: 'pt3'data[2] will be for id: 'bn5'