Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

_app.tsx

21 lines612 Bytes

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(() => new QueryClient())
12​
13 return (
14 <QueryClientProvider client={queryClient}>
15 <HydrationBoundary state={pageProps.dehydratedState}>
16 <Component {...pageProps} />
17 </HydrationBoundary>
18 <ReactQueryDevtools />
19 </QueryClientProvider>
20 )