Skip to content

Commit 12e128b

Browse files
authored
docs: update query function usage examples (TanStack#2394)
1 parent 8c1bb1f commit 12e128b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ 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)
11+
useQuery(['todos'], fetchAllTodos)
1212
useQuery(['todos', todoId], () => fetchTodoById(todoId))
1313
useQuery(['todos', todoId], async () => {
1414
const data = await fetchTodoById(todoId)
1515
return data
1616
})
17+
useQuery(['todos', todoId], ({ queryKey }) => fetchTodoById(queryKey[1]))
1718
```
1819

1920
## Handling and Throwing Errors

0 commit comments

Comments
 (0)