Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

QueryClientProvider.md

46 lines1.7 KB

function QueryClientProvider(props: QueryClientProviderProps): Element;

Defined in: packages/solid-query/src/QueryClientProvider.tsx:231

Provides the QueryClient and manages its mount lifecycle. On the server it also registers the cache serializer above; on the client, hooks prime the cache from their hash-keyed registry entries themselves (see useBaseQuery) and the provider subscribes the cache's single-flight consumer: mutation responses carrying a FLIGHT_DATA_SOURCE slice (a DehydratedState produced by a server collector registered under the same id) hydrate this client before the mutation's promise resolves. Subscribing is inert when no server collector exists β€” the server just folds nothing β€” so it is unconditional. One consumer per source: with nested providers, the innermost mounted one owns the slice.

Parameters

props

QueryClientProviderProps

The client to provide, and the children that get access to it.

props properties

PropertyTypeDescription
children?JSX.ElementThe components that get access to the provided QueryClient.
clientQueryClientRequired The QueryClient instance to provide.

Returns

Element

The provided children, wrapped so they can read the QueryClient via useQueryClient.