Skip to content

Commit 09d907e

Browse files
committed
docs: update query function usage examples
1 parent 9aed040 commit 09d907e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/src/pages/guides/query-functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ A query function can be literally any function that **returns a promise**. The p
88
All of the following are valid query function configurations:
99

1010
```js
11-
useQuery(['todos', todoId], fetchTodoById)
1211
useQuery(['todos', todoId], () => fetchTodoById(todoId))
1312
useQuery(['todos', todoId], async () => {
1413
const data = await fetchTodoById(todoId)
1514
return data
1615
})
16+
useQuery(['todos', todoId], ({ queryKey }) => fetchTodoById(queryKey[1]))
1717
```
1818

1919
## Handling and Throwing Errors

0 commit comments

Comments
 (0)