(queryClient?: QueryClient)
| 19 | * @throws If no `queryClient` argument is passed and no `QueryClientProvider` is found in the component tree. |
| 20 | */ |
| 21 | export const useQueryClient = (queryClient?: QueryClient) => { |
| 22 | const client = useContext(QueryClientContext) |
| 23 | |
| 24 | if (queryClient) { |
| 25 | return queryClient |
| 26 | } |
| 27 | |
| 28 | if (!client) { |
| 29 | throw new Error('No QueryClient set, use QueryClientProvider to set one') |
| 30 | } |
| 31 | |
| 32 | return client |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * The props accepted by `QueryClientProvider`. |
no outgoing calls