-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathroot.tsx
40 lines (34 loc) · 858 Bytes
/
root.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import './root.css';
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import {
createHashHistory,
createRouter,
ErrorComponent,
RouterProvider
} from '@tanstack/react-router';
import { routeTree } from './routeTree.gen';
const router = createRouter({
routeTree,
history: createHashHistory(),
caseSensitive: true,
defaultErrorComponent: ErrorComponent,
defaultNotFoundComponent: NotFound,
defaultPendingMinMs: 0,
defaultPreload: 'intent',
scrollRestoration: true
});
// Register the router instance for type safety
declare module '@tanstack/react-router' {
interface Register {
router: typeof router;
}
}
function NotFound() {
return 'Nothing to see here';
}
createRoot(document.getElementById('root')!).render(
<StrictMode>
<RouterProvider router={router} />
</StrictMode>
);