fp/services/next/app/components/query-provider.tsx

27 lines
547 B
TypeScript

// @see https://github.com/TanStack/query/issues/4933#issuecomment-1416892904
'use client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { useState } from 'react';
export default function QueryProvider({
children,
}: {
children: React.ReactNode
}) {
const [queryClient] = useState(() => new QueryClient({
defaultOptions: {
queries: {
staleTime: 60 * 1000
}
}
}))
return (
<QueryClientProvider client={queryClient}>
{children}
</QueryClientProvider>
);
}