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

__root.tsx

69 lines1.4 KB

1import * as React from 'react'
2import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'
3import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'
4​
5import { TanStackDevtools } from '@tanstack/react-devtools'
6​
7import Header from '../components/Header'
8import { RouteNavigationPanel } from '../devtools'
9​
10import appCss from '../styles.css?url'
11​
12export const Route = createRootRoute({
13 head: () => ({
14 meta: [
15 {
16 charSet: 'utf-8',
17 },
18 {
19 name: 'viewport',
20 content: 'width=device-width, initial-scale=1',
21 },
22 {
23 title: 'TanStack Start Starter',
24 },
25 ],
26 links: [
27 {
28 rel: 'stylesheet',
29 href: appCss,
30 },
31 ],
32 }),
33​
34 shellComponent: RootDocument,
35})
36​
37function RootDocument({ children }: { children: React.ReactNode }) {
38 console.log('Rendering Root Document')
39 const plugins = [
40 {
41 name: 'Tanstack Router',
42 render: <TanStackRouterDevtoolsPanel />,
43 },
44 {
45 id: 'route-navigation',
46 name: 'Route Navigation',
47 render: <RouteNavigationPanel />,
48 },
49 ]
50​
51 return (
52 <html lang="en">
53 <head>
54 <HeadContent />
55 </head>
56 <body>
57 <Header />
58 {children}
59 <TanStackDevtools
60 config={{
61 position: 'bottom-right',
62 }}
63 plugins={plugins}
64 />
65 <Scripts />
66 </body>
67 </html>
68 )