Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

useQueries.md

21 lines473 Bytes

1---
2id: useQueries
3title: useQueries
4---
5​
6The `useQueries` hook can be used to fetch a variable number of queries:
7​
8```js
9const results = useQueries([
10 { queryKey: ['post', 1], queryFn: fetchPost },
11 { queryKey: ['post', 2], queryFn: fetchPost },
12])
13```
14​
15**Options**
16​
17The `useQueries` hook accepts an array with query option objects identical to the [`useQuery` hook](/reference/useQuery).
18​
19**Returns**
20​
21The `useQueries` hook returns an array with all the query results.