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

__root.tsx

41 lines819 Bytes

1/// <reference types="vite/client" />
2import * as React from 'react'
3import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
4import {
5 HeadContent,
6 Link,
7 Outlet,
8 Scripts,
9 createRootRoute,
10} from '@tanstack/react-router'
11import appCss from '~/styles/app.css?url'
12​
13export const Route = createRootRoute({
14 head: () => ({
15 links: [{ rel: 'stylesheet', href: appCss }],
16 }),
17 component: RootComponent,
18})
19​
20function RootComponent() {
21 return (
22 <RootDocument>
23 <Outlet />
24 </RootDocument>
25 )
27​
28function RootDocument({ children }: { children: React.ReactNode }) {
29 return (
30 <html>
31 <head>
32 <HeadContent />
33 </head>
34 <body>
35 {children}
36 <TanStackRouterDevtools position="bottom-right" />
37 <Scripts />
38 </body>
39 </html>
40 )