import { QueryClient } from '@tanstack/react-query' import { createRouter as createTanStackRouter } from '@tanstack/react-router' import { routerWithQueryClient } from '@tanstack/react-router-with-query' import { routeTree } from './routeTree.gen' import { DefaultCatchBoundary } from './components/DefaultCatchBoundary' import { NotFound } from './components/NotFound' // NOTE: Most of the integration code found here is experimental and will // definitely end up in a more streamlined API in the future. This is just // to show what's possible with the current APIs. export function createRouter() { const queryClient = new QueryClient() return routerWithQueryClient( createTanStackRouter({ routeTree, context: { queryClient }, scrollRestoration: true, defaultPreload: 'intent', defaultErrorComponent: DefaultCatchBoundary, defaultNotFoundComponent: () => , }), queryClient, ) } declare module '@tanstack/react-router' { interface Register { router: ReturnType } }