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

query-functions.md

22 lines428 Bytes

1---
2id: query-functions
3title: Query Functions
4ref: docs/framework/react/guides/query-functions.md
5---
6​
7[//]: # 'Example4'
8​
9```js
10const result = useQuery({
11 queryKey: ['todos', { status, page }],
12 queryFn: fetchTodoList,
13})
14​
15// Access the key, status and page variables in your query function!
16function fetchTodoList({ queryKey }) {
17 const [_key, { status, page }] = queryKey
18 return new Promise()
20```
21​
22[//]: # 'Example4'