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

__root.tsx

48 lines926 Bytes

1import * as React from 'react'
2import {
3 HeadContent,
4 Outlet,
5 Scripts,
6 createRootRouteWithContext,
7} from '@tanstack/react-router'
8import appCss from '../styles.css?url'
9import type { RouterContext } from '../router'
10​
11export const Route = createRootRouteWithContext<RouterContext>()({
12 head: () => ({
13 meta: [
14 {
15 charSet: `utf-8`,
16 },
17 {
18 name: `viewport`,
19 content: `width=device-width, initial-scale=1`,
20 },
21 {
22 title: `TanStack DB Start SSR E2E`,
23 },
24 ],
25 links: [
26 {
27 rel: `stylesheet`,
28 href: appCss,
29 },
30 ],
31 }),
32 shellComponent: RootDocument,
33 component: () => <Outlet />,
34})
35​
36function RootDocument({ children }: { children: React.ReactNode }) {
37 return (
38 <html lang="en">
39 <head>
40 <HeadContent />
41 </head>
42 <body>
43 {children}
44 <Scripts />
45 </body>
46 </html>
47 )