Open History to see the last commit
1<% if (!fileRouter) { ignoreFile() } %>import { Outlet<% if (addOnEnabled.start) { %>
2, HeadContent, Scripts<% } %>, <% if (addOnEnabled["tanstack-query"]) { %>createRootRouteWithContext<% } else { %>createRootRoute<% } %> } from '@tanstack/react-router'
3import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
4<% if (addOns.length) { %>
5import Header from '../components/Header'
6<% } %><% for(const integration of integrations.filter(i => i.type === 'layout' || i.type === 'provider')) { %>
7import <%= integration.jsName %> from "<%= relativePath(integration.path) %>";
8<% } %>
9<% if (addOnEnabled.start) { %>
10import appCss from '../styles.css?url'
11<% } %><% if (addOnEnabled["tanstack-query"]) { %>
12import type { QueryClient } from '@tanstack/react-query'
13<% if (addOnEnabled.tRPC) { %>
14import type { TRPCRouter } from '@/integrations/trpc/router'
15import type { TRPCOptionsProxy } from '@trpc/tanstack-react-query'
16<% } %>
17
18interface MyRouterContext {
19 queryClient: QueryClient
20 <% if (addOnEnabled.tRPC) { %>
21 trpc: TRPCOptionsProxy<TRPCRouter>
22 <% } %>
23}<% } %>
25export const Route = <% if (addOnEnabled["tanstack-query"]) { %>createRootRouteWithContext<MyRouterContext>()<% } else { %>createRootRoute<% } %>({
26<% if (addOnEnabled.start) { %>
27 head: () => ({
28 meta: [
29 {
30 charSet: 'utf-8',
31 },
32 {
33 name: 'viewport',
34 content: 'width=device-width, initial-scale=1',
35 },
36 {
37 title: 'TanStack Start Starter',
38 },
39 ],
40 links: [
41 {
42 rel: 'stylesheet',
43 href: appCss,
44 },
45 ],
46 }),
47<% } %>
48 component: () => (
49<% if (addOnEnabled.start) { %><RootDocument><% } else { %><><% } %>
50 <% for(const integration of integrations.filter(i => i.type === 'provider')) { %>
51 <<%= integration.jsName %>>
52 <% } %>
53 <% if (addOns.length) { %>
54 <Header />
55 <% } %>
56 <Outlet />
57 <TanStackRouterDevtools />
58 <% for(const integration of integrations.filter(i => i.type === 'layout')) { %>
59 <<%= integration.jsName %> />
60 <% } %>
61 <% for(const integration of integrations.filter(i => i.type === 'provider').reverse()) { %>
62 </<%= integration.jsName %>>
63 <% } %>
64<% if (addOnEnabled.start) { %></RootDocument><% } else { %></><% } %>
65 ),
66})
67
68<% if (addOnEnabled.start) { %>
69function RootDocument({ children }: { children: React.ReactNode }) {
70 return (
71 <html lang="en">
72 <head>
73 <HeadContent />
74 </head>
75 <body>
76 {children}
77 <Scripts />
78 </body>
79 </html>
80 )
81}
82<% } %>