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

QueryClientProvider.md

46 lines1.7 KB

1---
2id: QueryClientProvider
3title: QueryClientProvider
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8```ts
9function QueryClientProvider(props: QueryClientProviderProps): Element;
10```
11​
12Defined in: [packages/solid-query/src/QueryClientProvider.tsx:231](https://github.com/TanStack/query/blob/main/packages/solid-query/src/QueryClientProvider.tsx#L231)
13​
14Provides the QueryClient and manages its mount lifecycle. On the server
15it also registers the cache serializer above; on the client, hooks prime
16the cache from their hash-keyed registry entries themselves (see
17`useBaseQuery`) and the provider subscribes the cache's single-flight
18consumer: mutation responses carrying a `FLIGHT_DATA_SOURCE` slice (a
19`DehydratedState` produced by a server collector registered under the
20same id) hydrate this client before the mutation's promise resolves.
21Subscribing is inert when no server collector exists β€” the server just
22folds nothing β€” so it is unconditional. One consumer per source: with
23nested providers, the innermost mounted one owns the slice.
24​
25## Parameters
26​
27### props
28​
29[`QueryClientProviderProps`](../type-aliases/QueryClientProviderProps.md)
30​
31The `client` to provide, and the `children` that get access to it.
32​
33<a id="props-properties"></a>
34​
35#### `props` properties
36​
37| Property | Type | Description |
38| ------ | ------ | ------ |
39| <a id="props-property-children"></a> `children?` | `JSX.Element` | The components that get access to the provided `QueryClient`. |
40| <a id="props-property-client"></a> `client` | [`QueryClient`](../classes/QueryClient.md) | **Required** The `QueryClient` instance to provide. |
41​
42## Returns
43​
44`Element`
45​
46The provided `children`, wrapped so they can read the `QueryClient` via `useQueryClient`.