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

__root.tsx

49 lines874 Bytes

1import * as React from 'react'
2import {
3 HeadContent,
4 Outlet,
5 Scripts,
6 createRootRoute,
7} from '@tanstack/react-router'
8import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
9​
10export const Route = createRootRoute({
11 head: () => ({
12 meta: [
13 {
14 charSet: 'utf-8',
15 },
16 {
17 name: 'viewport',
18 content: 'width=device-width, initial-scale=1',
19 },
20 {
21 title: 'TanStack Start Starter',
22 },
23 ],
24 }),
25 component: RootComponent,
26})
27​
28function RootComponent() {
29 return (
30 <RootDocument>
31 <Outlet />
32 <TanStackRouterDevtools />
33 </RootDocument>
34 )
36​
37function RootDocument({ children }: { children: React.ReactNode }) {
38 return (
39 <html>
40 <head>
41 <HeadContent />
42 </head>
43 <body>
44 {children}
45 <Scripts />
46 </body>
47 </html>
48 )