Open History to see the last commit
1import {
2 HeadContent,
3 Link,
4 Outlet,
5 createRootRouteWithContext,
6} from '@tanstack/solid-router'
7import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
8import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
9import type { QueryClient } from '@tanstack/solid-query'
10β
11export const Route = createRootRouteWithContext<{
12 queryClient: QueryClient
13}>()({
14 component: RootComponent,
15 notFoundComponent: () => {
16 return (
17 <div>
18 <p>This is the notFoundComponent configured on root route</p>
19 <Link to="/">Start Over</Link>
20 </div>
21 )
22 },
23})
24β
25function RootComponent() {
26 return (
27 <>
28 <HeadContent />
29 <div class="p-2 flex gap-2 text-lg">
30 <Link
31 to="/"
32 activeProps={{
33 class: 'font-bold',
34 }}
35 activeOptions={{ exact: true }}
36 >
37 Home
38 </Link>{' '}
39 <Link
40 to="/posts"
41 activeProps={{
42 class: 'font-bold',
43 }}
44 >
45 Posts
46 </Link>{' '}
47 <Link
48 to="/route-a"
49 activeProps={{
50 class: 'font-bold',
51 }}
52 >
53 Pathless Layout
54 </Link>{' '}
55 <Link
56 // @ts-expect-error
57 to="/this-route-does-not-exist"
58 activeProps={{
59 class: 'font-bold',
60 }}
61 >
62 This Route Does Not Exist
63 </Link>
64 </div>
65 <hr />
66 <Outlet />
67 <SolidQueryDevtools buttonPosition="top-right" />
68 <TanStackRouterDevtools position="bottom-right" />
69 </>
70 )
71}