Making progress on rewrite. Looking into supabase cache helpers.
This commit is contained in:
22
src/lib/hooks/context/use-query.tsx
Normal file
22
src/lib/hooks/context/use-query.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
'use client'
|
||||
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { useState } from 'react'
|
||||
|
||||
const ReactQueryClientProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const [queryClient] = useState(
|
||||
() =>
|
||||
new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
// With SSR, we usually want to set some default staleTime
|
||||
// above 0 to avoid refetching immediately on the client
|
||||
staleTime: 60 * 1000,
|
||||
},
|
||||
},
|
||||
})
|
||||
)
|
||||
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||
};
|
||||
|
||||
export { ReactQueryClientProvider };
|
Reference in New Issue
Block a user