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

QueryClientProvider.md

24 lines818 Bytes

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 'react-query'
10​
11const queryClient = new QueryClient()
12​
13function App() {
14 return <QueryClientProvider client={queryClient}>...</QueryClientProvider>
16```
17**Options**
18​
19- `client: QueryClient`
20 - **Required**
21 - the QueryClient instance to provide
22- `contextSharing: boolean`
23 - defaults to `false`
24 - 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.