Open History to see the last commit
1---
2id: QueryClientProvider
3title: QueryClientProvider
4---
5β
6Use the `QueryClientProvider` component to connect and provide a `QueryClient` to your application:
7β
8```js
9import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
10β
11const queryClient = new QueryClient()
12β
13function App() {
14 return <QueryClientProvider client={queryClient}>...</QueryClientProvider>
15}
16```
17β
18**Options**
19β
20- `client: QueryClient`
21 - **Required**
22 - the QueryClient instance to provide
23- `contextSharing: boolean`
24 - defaults to `false`
25 - Set this to `true` to enable context sharing, which will share the first and at least one instance of the context across the window to ensure that if React Query is used across different bundles or microfrontends they will all use the same **instance** of context, regardless of module scoping.
26- `context?: React.Context<QueryClient | undefined>`
27 - Use this to use a custom React Query context. Otherwise, `defaultContext` will be used.