MCPcopy Create free account
hub / github.com/TanStack/query / useQueryClient

Function useQueryClient

packages/lit-query/src/context.ts:105–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

103 * mounted and the default is ambiguous.
104 */
105export function useQueryClient(): QueryClient {
106 const client = getDefaultQueryClient()
107 if (client) {
108 return client
109 }
110
111 if (registeredClients.size > 1) {
112 throw createAmbiguousQueryClientError()
113 }
114
115 throw createMissingQueryClientError()
116}
117
118/**
119 * Resolves an explicit `QueryClient` or falls back to `useQueryClient`.

Callers 5

prefetchMethod · 0.90
renderMethod · 0.90
renderMethod · 0.90
resolveQueryClientFunction · 0.70

Calls 3

getDefaultQueryClientFunction · 0.85

Tested by

no test coverage detected