Wait for multiple queries to succeed
I'm looking for a way to wait for all queries to have the success status, is there some build in equivalent like this example below?
3 Replies
extended-salmon•12mo ago
useQueries | TanStack Query React Docs
The useQueries hook can be used to fetch a variable number of queries: tsx const ids = [1, 2, 3] const results = useQueries({ queries: ids.map((id) = ({ queryKey: ['post', id], queryFn: () = fetchPost...
graceful-blueOP•12mo ago
But what is
useTeamsFind and useTeamUsersPaginate are already wrappers on the useQuery hook?extended-salmon•12mo ago
I would convert them to
queryOptions
You can have both queryOptions and hook versions of teams and use them as necessary.
Then you can useQueries with teamsQuery where it's useful, use the useTeamsQuery hook where that's useful, etc.