Open History to see the last commit
1import { createRouter } from '@tanstack/react-router'
2import { QueryClient } from '@tanstack/react-query'
3import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query'
4import { routeTree } from './routeTree.gen'
5import { DefaultCatchBoundary } from './components/DefaultCatchBoundary'
6import { NotFound } from './components/NotFound'
7β
8export function getRouter() {
9 const queryClient = new QueryClient()
10 const router = createRouter({
11 routeTree,
12 defaultPreload: 'intent',
13 defaultErrorComponent: DefaultCatchBoundary,
14 defaultNotFoundComponent: () => <NotFound />,
15 scrollRestoration: true,
16 context: {
17 foo: {
18 bar: 'baz',
19 },
20 },
21 })
22 setupRouterSsrQueryIntegration({ router, queryClient })
23β
24 return router
25}