Open History to see the last commit
1import React from 'react'
2import {
3 HydrationBoundary,
4 QueryClient,
5 QueryClientProvider,
6} from '@tanstack/react-query'
7import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
8import type { AppProps } from 'next/app'
9β
10export default function MyApp({ Component, pageProps }: AppProps) {
11 const [queryClient] = React.useState(
12 () =>
13 new QueryClient({
14 defaultOptions: {
15 queries: {
16 staleTime: 60 * 1000,
17 },
18 },
19 }),
20 )
21β
22 return (
23 <QueryClientProvider client={queryClient}>
24 <HydrationBoundary state={pageProps.dehydratedState}>
25 <Component {...pageProps} />
26 </HydrationBoundary>
27 <ReactQueryDevtools />
28 </QueryClientProvider>
29 )
30}