I have the following case. I want to get all users and their data on a listing page. The API has the following structure when you call getUsers it just returns an array of ids. Then I need to get each user data by calling getUser query.
What I want is to have something like this, which I know it doesn't work but am wondering how to achieve:
const { data } = useQuery("/api/users", getUsers);
Promise.all(data.map((user) => useQuery("/api/user/" + user.id, getUser)));