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

router.tsx

19 lines604 Bytes

1import { createRouter } from '@tanstack/react-router'
2import { getGlobalStartContext } from '@tanstack/react-start'
3import { routeTree } from './routeTree.gen'
4import { DefaultCatchBoundary } from './components/DefaultCatchBoundary'
5import { NotFound } from './components/NotFound'
6​
7export function getRouter() {
8 const router = createRouter({
9 routeTree,
10 defaultPreload: 'intent',
11 defaultErrorComponent: DefaultCatchBoundary,
12 defaultNotFoundComponent: () => <NotFound />,
13 scrollRestoration: true,
14 ssr: {
15 nonce: getGlobalStartContext()?.nonce,
16 },
17 })
18 return router