Skip to content

Commit

Permalink
Slight tweak to useQueryRefHandlers tsdoc and add example
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Dec 18, 2023
1 parent 5a78004 commit 937ddda
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/react/hooks/useQueryRefHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
*/
Expand Down

0 comments on commit 937ddda

Please sign in to comment.