2024-02-12 19:42:56 -08:00
|
|
|
'use client'
|
|
|
|
|
2024-02-17 14:54:14 -08:00
|
|
|
import { useMemo } from 'react'
|
2024-02-12 19:42:56 -08:00
|
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
|
|
|
2024-02-17 14:54:14 -08:00
|
|
|
type ProvidersProps = {
|
|
|
|
children: React.ReactNode
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Providers({ children }: Readonly<ProvidersProps>) {
|
2024-02-17 14:56:26 -08:00
|
|
|
const queryClient = useMemo(
|
|
|
|
() =>
|
2024-02-12 19:42:56 -08:00
|
|
|
new QueryClient({
|
|
|
|
defaultOptions: {
|
|
|
|
queries: {
|
|
|
|
staleTime: 60 * 1000,
|
|
|
|
},
|
|
|
|
},
|
2024-02-17 14:56:26 -08:00
|
|
|
}),
|
|
|
|
[]
|
|
|
|
)
|
2024-02-12 19:42:56 -08:00
|
|
|
return (
|
|
|
|
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
|
|
|
)
|
|
|
|
}
|