From e110092b6c736494483b5c1326a316f702fdeb92 Mon Sep 17 00:00:00 2001 From: JongHan Leem Date: Wed, 29 Nov 2023 01:21:41 +0900 Subject: [PATCH] docs: add documentation for optional `queryKey` (#78) Co-authored-by: JongHan Leem --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 55d6caa..217346c 100644 --- a/README.md +++ b/README.md @@ -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: