MCPcopy
hub / github.com/TanStack/router / RootComponent

Function RootComponent

e2e/solid-router/basic-file-based/src/routes/__root.tsx:24–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22})
23
24function RootComponent() {
25 const router = useRouter()
26 const canGoBack = useCanGoBack()
27 // test useRouterState doesn't crash client side navigation
28 const _state = useRouterState()
29
30 return (
31 <>
32 <HeadContent />
33 <div class="flex gap-2 p-2 text-lg border-b">
34 <button
35 data-testid="back-button"
36 disabled={!canGoBack()}
37 onClick={() => router.history.back()}
38 class={!canGoBack() ? 'line-through' : undefined}
39 >
40 Back
41 </button>{' '}
42 <Link
43 to="/"
44 activeProps={{
45 class: 'font-bold',
46 }}
47 activeOptions={{ exact: true }}
48 >
49 Home
50 </Link>{' '}
51 <Link
52 to="/posts"
53 activeProps={{
54 class: 'font-bold',
55 }}
56 >
57 Posts
58 </Link>{' '}
59 <Link
60 to="/layout-a"
61 activeProps={{
62 class: 'font-bold',
63 }}
64 >
65 Layout
66 </Link>{' '}
67 <Link
68 to="/onlyrouteinside"
69 data-testid="link-to-only-route-inside-group"
70 search={{ hello: 'world' }}
71 activeProps={{
72 class: 'font-bold',
73 }}
74 >
75 Only Route Inside Group
76 </Link>{' '}
77 <Link
78 to="/inside"
79 data-testid="link-to-route-inside-group"
80 search={{ hello: 'world' }}
81 activeProps={{

Callers

nothing calls this directly

Calls 3

useRouterFunction · 0.90
useCanGoBackFunction · 0.90
useRouterStateFunction · 0.90

Tested by

no test coverage detected