feat(frontends): added vite and docusorus into the games
This commit is contained in:
34
frontend/src/integrations/tanstack-query/root-provider.tsx
Normal file
34
frontend/src/integrations/tanstack-query/root-provider.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
|
||||
let context:
|
||||
| {
|
||||
queryClient: QueryClient
|
||||
}
|
||||
| undefined
|
||||
|
||||
export function getContext() {
|
||||
if (context) {
|
||||
return context
|
||||
}
|
||||
|
||||
const queryClient = new QueryClient()
|
||||
|
||||
context = {
|
||||
queryClient,
|
||||
}
|
||||
|
||||
return context
|
||||
}
|
||||
|
||||
export default function TanStackQueryProvider({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode
|
||||
}) {
|
||||
const { queryClient } = getContext()
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user