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