-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathApp.tsx
More file actions
56 lines (49 loc) · 951 Bytes
/
App.tsx
File metadata and controls
56 lines (49 loc) · 951 Bytes
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
import {
Link,
Outlet,
RouterProvider,
createRootRoute,
createRoute,
createRouter,
} from '@tanstack/react-router'
function AppShell() {
return (
<div>
<nav
style={{
display: 'flex',
gap: 12,
padding: '16px 24px 0',
}}
>
<Link to="/">Home</Link>
<Link to="/about">About</Link>
</nav>
<Outlet />
</div>
)
}
const rootRoute = createRootRoute({
component: AppShell,
})
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
component: () => {
return <h1>Home</h1>
},
})
const aboutRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/about',
component: () => {
return <h1>About</h1>
},
})
const routeTree = rootRoute.addChildren([indexRoute, aboutRoute])
const router = createRouter({
routeTree,
})
export default function App() {
return <RouterProvider router={router} />
}