__root.tsx
1 import { createRootRoute } from '@tanstack/react-router' 2 import { Outlet, ScrollRestoration } from '@tanstack/react-router' 3 import { Body, Head, Html, Meta, Scripts } from '@tanstack/start' 4 import * as React from 'react' 5 6 export const Route = createRootRoute({ 7 meta: () => [ 8 { 9 charSet: 'utf-8', 10 }, 11 { 12 name: 'viewport', 13 content: 'width=device-width, initial-scale=1', 14 }, 15 { 16 title: 'TanStack Start App' 17 } 18 ], 19 component: RootComponent, 20 }) 21 22 23 function RootComponent(){ 24 return ( 25 <RootDocument> 26 <Outlet /> 27 </RootDocument> 28 ) 29 } 30 31 function RootDocument({ children }: { children: React.ReactNode }){ 32 return ( 33 <Html> 34 <Head> 35 <Meta /> 36 </Head> 37 <Body> 38 {children} 39 <ScrollRestoration /> 40 <Scripts /> 41 </Body> 42 </Html> 43 ) 44 }