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

__root.tsx

47 lines1000 Bytes

1import {
2 HeadContent,
3 Outlet,
4 Scripts,
5 createRootRoute,
6} from '@tanstack/solid-router'
7​
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'
12​
13export const Route = createRootRoute({
14 head: () => ({
15 meta: [
16 {
17 charSet: 'utf-8',
18 },
19 {
20 name: 'viewport',
21 content: 'width=device-width, initial-scale=1',
22 },
23 ],
24 links: [{ rel: 'stylesheet', href: appCss }],
25 }),
26 errorComponent: (props) => {
27 return <p>{props.error.stack}</p>
28 },
29 notFoundComponent: () => <NotFound />,
30 component: RootComponent,
31})
32​
33function RootComponent() {
34 return (
35 <html>
36 <head>
37 <HydrationScript />
38 </head>
39 <body>
40 <HeadContent />
41 <Outlet />
42 <TanStackRouterDevtools position="bottom-right" />
43 <Scripts />
44 </body>
45 </html>
46 )