Skip to content

Commit

Permalink
docs: add documentation for optional queryKey (#78)
Browse files Browse the repository at this point in the history
Co-authored-by: JongHan Leem <jleem@gymblic.com>
  • Loading branch information
jleem99 and JongHan Leem authored Nov 28, 2023
1 parent c65e1ed commit e110092
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ export const todos = createQueryKeys('todos', {
// }
```

`queryKey` can be optional when there's no need for a dynamic query:

```ts
export const users = createQueryKeys('users', {
list: {
queryKey: null,
queryFn: () => api.getUsers(),
}
});
```

### Generate the query options you need to run `useQuery`
Declare your `queryKey` and your `queryFn` together, and have easy access to everything you need to run a query:

Expand Down

0 comments on commit e110092

Please sign in to comment.