Skip to content

Commit 542ad07

Browse files
authored
docs: update query-key docs (#2214)
1 parent 4083c1e commit 542ad07

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

docs/src/pages/guides/default-query-function.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ If you find yourself wishing for whatever reason that you could just share the s
77

88
```js
99
// Define a default query function that will receive the query key
10+
// the queryKey is guaranteed to be an Array here
1011
const defaultQueryFn = async ({ queryKey }) => {
1112
const { data } = await axios.get(`https://jsonplaceholder.typicode.com${queryKey[0]}`);
1213
return data;

docs/src/pages/reference/useInfiniteQuery.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ The options for `useInfiniteQuery` are identical to the [`useQuery` hook](/refer
2727
- **Required, but only if no default query function has been defined** [`defaultQueryFn`](/guides/default-query-function)
2828
- The function that the query will use to request data.
2929
- Receives a `QueryFunctionContext` object with the following variables:
30-
- `queryKey: QueryKey`
30+
- `queryKey: EnsuredQueryKey`: the queryKey, guaranteed to be an Array
3131
- `pageParam: unknown | undefined`
32-
- Must return a promise that will either resolves data or throws an error.
32+
- Must return a promise that will either resolve data or throw an error.
3333
- Make sure you return the data *and* the `pageParam` if needed for use in the props below.
3434
- `getNextPageParam: (lastPage, allPages) => unknown | undefined`
3535
- When new data is received for this query, this function receives both the last page of the infinite list of data and the full array of all pages.

docs/src/pages/reference/useQuery.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ const result = useQuery({
7373
- **Required, but only if no default query function has been defined** See [Default Query Function](../guides/default-query-function) for more information.
7474
- The function that the query will use to request data.
7575
- Receives a `QueryFunctionContext` object with the following variables:
76-
- `queryKey: QueryKey`
77-
- Must return a promise that will either resolves data or throws an error.
76+
- `queryKey: EnsuredQueryKey`: the queryKey, guaranteed to be an Array
77+
- Must return a promise that will either resolve data or throw an error.
7878
- `enabled: boolean`
7979
- Set this to `false` to disable this query from automatically running.
8080
- Can be used for [Dependent Queries](../guides/dependent-queries).

0 commit comments

Comments
 (0)