-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproviders.tsx
More file actions
24 lines (21 loc) · 775 Bytes
/
providers.tsx
File metadata and controls
24 lines (21 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { QueryClient } from '@tanstack/react-query';
import { PersistQueryClientProvider } from '@tanstack/react-query-persist-client';
import { createAsyncStoragePersister } from '@tanstack/query-async-storage-persister';
import { ThemeProvider } from './components/theme';
const queryClient = new QueryClient({
defaultOptions: {
queries: {
gcTime: 1000 * 60 * 60 * 24 * 7, // 7 days of caching
},
},
});
const persister = createAsyncStoragePersister({
storage: window.localStorage,
});
export const AppProvider = ({ children }: { children: React.ReactNode }) => {
return (
<PersistQueryClientProvider client={queryClient} persistOptions={{ persister }}>
<ThemeProvider>{children}</ThemeProvider>
</PersistQueryClientProvider>
);
};