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

__root.tsx

73 lines1.6 KB

1/// <reference types="vite/client" />
2import {
3 HeadContent,
4 Outlet,
5 Scripts,
6 createRootRoute,
7} from '@tanstack/solid-router'
8import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
9import { HydrationScript } from 'solid-js/web'
10import { NotFound } from '~/components/NotFound'
11import appCss from '~/styles/app.css?url'
12import { seo } from '~/utils/seo'
13​
14export const Route = createRootRoute({
15 head: () => ({
16 meta: [
17 {
18 charset: 'utf-8',
19 },
20 {
21 name: 'viewport',
22 content: 'width=device-width, initial-scale=1',
23 },
24 ...seo({
25 title: 'TanStack Website',
26 description: `TanStack projects are type-safe!!!`,
27 }),
28 ],
29 links: [
30 { rel: 'stylesheet', href: appCss },
31 {
32 rel: 'apple-touch-icon',
33 sizes: '180x180',
34 href: '/apple-touch-icon.png',
35 },
36 {
37 rel: 'icon',
38 type: 'image/png',
39 sizes: '32x32',
40 href: '/favicon-32x32.png',
41 },
42 {
43 rel: 'icon',
44 type: 'image/png',
45 sizes: '16x16',
46 href: '/favicon-16x16.png',
47 },
48 { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },
49 { rel: 'icon', href: '/favicon.ico' },
50 ],
51 }),
52 errorComponent: (props) => {
53 return <p>{props.error.stack}</p>
54 },
55 notFoundComponent: () => <NotFound />,
56 component: RootComponent,
57})
58​
59function RootComponent() {
60 return (
61 <html>
62 <head>
63 <HydrationScript />
64 </head>
65 <body>
66 <HeadContent />
67 <Outlet />
68 <TanStackRouterDevtools position="bottom-right" />
69 <Scripts />
70 </body>
71 </html>
72 )