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

router.tsx

22 lines631 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 scrollRestoration: true,
13 })
14​
15 return router
17​
18declare module '@tanstack/react-router' {
19 interface Register {
20 router: ReturnType<typeof createRouter>
21 }