-
-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathsetup.tsx
More file actions
81 lines (74 loc) · 1.9 KB
/
setup.tsx
File metadata and controls
81 lines (74 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { QueryClient, QueryClientProvider } from '@tanstack/solid-query'
import { SolidQueryDevtools } from '@tanstack/solid-query-devtools'
import { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'
import {
Outlet,
createRouter,
createRoute,
createRootRoute,
} from '@tanstack/solid-router'
import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools'
import { Devtools } from '@tanstack/solid-devtools'
import { Portal } from 'solid-js/web'
const rootRoute = createRootRoute({
component: () => (
<>
<div class="p-2 flex gap-2"></div>
<hr />
<Outlet />
<TanStackRouterDevtools />
</>
),
})
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
component: function Index() {
return (
<div class="p-2">
<h3>Welcome Home!</h3>
</div>
)
},
})
const aboutRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/about',
component: function About() {
return <div class="p-2">Hello from About!</div>
},
})
const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])
const router = createRouter({ routeTree })
const queryClient = new QueryClient()
export default function DevtoolsExample() {
return (
<>
<Devtools
plugins={[
{
id: 'query',
name: 'Tanstack Query',
render: (el) => (
<Portal mount={el}>
{' '}
<QueryClientProvider client={queryClient}>
<SolidQueryDevtools />
</QueryClientProvider>{' '}
</Portal>
),
},
{
id: 'router',
name: 'Tanstack Router',
render: (el) => (
<Portal mount={el}>
<TanStackRouterDevtoolsPanel router={router} />
</Portal>
),
},
]}
/>
</>
)
}