Initialize tanstack/start

This commit is contained in:
2024-09-02 20:04:44 +02:00
parent 16ae786e11
commit fb8a9ce6e2
11 changed files with 8180 additions and 0 deletions

43
app/routes/__root.tsx Normal file
View File

@ -0,0 +1,43 @@
import { createRootRoute } from '@tanstack/react-router'
import { Outlet, ScrollRestoration } from '@tanstack/react-router'
import { Body, Head, Html, Meta, Scripts } from '@tanstack/start'
import * as React from 'react'
export const Route = createRootRoute({
meta: () => [
{
charSet: 'utf-8',
},
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
{
title: 'TanStack Start Starter',
},
],
component: RootComponent,
})
function RootComponent() {
return (
<RootDocument>
<Outlet />
</RootDocument>
)
}
function RootDocument({ children }: { children: React.ReactNode }) {
return (
<Html>
<Head>
<Meta />
</Head>
<Body>
{children}
<ScrollRestoration />
<Scripts />
</Body>
</Html>
)
}

14
app/routes/index.tsx Normal file
View File

@ -0,0 +1,14 @@
import { createFileRoute, useRouter } from '@tanstack/react-router'
export const Route = createFileRoute('/')({
component: Home,
})
function Home() {
const router = useRouter()
const state = Route.useLoaderData()
return (
<h1>Hello World();</h1>
)
}