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

router.tsx

21 lines602 Bytes

1import { createRouter as createTanStackRouter } from '@tanstack/react-router'
2import { routeTree } from './routeTree.gen'
3import { DefaultCatchBoundary } from './components/DefaultCatchBoundary'
4import { NotFound } from './components/NotFound'
5​
6export function createRouter() {
7 const router = createTanStackRouter({
8 routeTree,
9 defaultPreload: 'intent',
10 defaultErrorComponent: DefaultCatchBoundary,
11 defaultNotFoundComponent: () => <NotFound />,
12 })
13​
14 return router
16​
17declare module '@tanstack/react-router' {
18 interface Register {
19 router: ReturnType<typeof createRouter>
20 }