File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ yarn add @tanstack/query-async-storage-persister @tanstack/react-query-persist-c
1919- Import the ` createAsyncStoragePersister ` function
2020- Create a new asyncStoragePersister
2121 - you can pass any ` storage ` to it that adheres to the ` AsyncStorage ` interface - the example below uses the async-storage from React Native
22- - Pass it to the [ ` persistQueryClient ` ] ( ../plugins/persistQueryClient ) function
22+ - Wrap your app by using [ ` PersistQueryClientProvider ` ] ( ../plugins/persistQueryClient.md#persistqueryclientprovider ) component.
2323
2424``` ts
2525import AsyncStorage from ' @react-native-async-storage/async-storage'
26- import { persistQueryClient } from ' @tanstack/react-query-persist-client'
26+ import { PersistQueryClientProvider } from ' @tanstack/react-query-persist-client'
2727import { createAsyncStoragePersister } from ' @tanstack/query-async-storage-persister'
2828
2929const queryClient = new QueryClient ({
@@ -38,10 +38,16 @@ const asyncStoragePersister = createAsyncStoragePersister({
3838 storage: AsyncStorage
3939})
4040
41- persistQueryClient ({
42- queryClient ,
43- persister: asyncStoragePersister ,
44- })
41+ const Root = () => (
42+ < PersistQueryClientProvider
43+ client = {queryClient }
44+ persistOptions = {{ persister : asyncStoragePersister }}
45+ >
46+ < App / >
47+ < / PersistQueryClientProvider >
48+ );
49+
50+ export default Root ;
4551```
4652
4753## Retries
You can’t perform that action at this time.
0 commit comments