From 937dddaace1fb4a1face5bcb4f1a66e5ab5b2214 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Mon, 18 Dec 2023 09:49:13 -0700 Subject: [PATCH] Slight tweak to useQueryRefHandlers tsdoc and add example --- src/react/hooks/useQueryRefHandlers.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/react/hooks/useQueryRefHandlers.ts b/src/react/hooks/useQueryRefHandlers.ts index 39d52163ff0..b7f58da2f23 100644 --- a/src/react/hooks/useQueryRefHandlers.ts +++ b/src/react/hooks/useQueryRefHandlers.ts @@ -23,8 +23,19 @@ export interface UseQueryRefHandlersResult< /** * A React hook that returns a `refetch` and `fetchMore` function for a given * `queryRef`. - * This allows you to control the lifecyle of a queryRef from a different component - * than the one that created it. + * + * This is useful to get access to handlers for a `queryRef` that was created by + * `createQueryPreloader` or when the handlers for a `queryRef` produced in + * a different component are inaccessible. + * + * @example + * ```tsx + * const MyComponent({ queryRef }) { + * const { refetch, fetchMore } = useQueryRefHandlers(queryRef) + * + * // ... + * } + * ``` * * @param queryRef a `QueryReference` returned from `useBackgroundQuery` or `createQueryPreloader`. */