import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'
import { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'
import { NotFound } from '~/components/NotFound'
import appCss from '~/styles/app.css?url'
import { seo } from '~/utils/seo'
export const Route = createRootRoute({
head: () => ({
meta: [
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
...seo({
title:
'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',
description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,
}),
],
links: [
{ rel: 'stylesheet', href: appCss },
{
rel: 'apple-touch-icon',
sizes: '180x180',
href: '/apple-touch-icon.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: '/favicon-32x32.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: '/favicon-16x16.png',
},
{ rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },
{ rel: 'icon', href: '/favicon.ico' },
],
}),
errorComponent: (props) => <p>{props.error.stack}</p>,
notFoundComponent: () => <NotFound />,
component: RootComponent,
})
function RootComponent() {
return (
<>
<div class="p-2 flex gap-2 text-lg">
<Link
to="/"
activeProps={{
class: 'font-bold',
}}
activeOptions={{ exact: true }}
>
Home
</Link>{' '}
<Link
to="/posts"
activeProps={{
class: 'font-bold',
}}
>
Posts
</Link>{' '}
<Link
to="/users"
activeProps={{
class: 'font-bold',
}}
>
Users
</Link>{' '}
<Link
to="/deferred"
activeProps={{
class: 'font-bold',
}}
>
Deferred
</Link>{' '}
<Link
to="/redirect"
activeProps={{
class: 'font-bold',
}}
>
redirect
</Link>{' '}
<Link
// @ts-expect-error
to="/this-route-does-not-exist"
activeProps={{
class: 'font-bold',
}}
>
This Route Does Not Exist
</Link>
</div>
<Outlet />
<TanStackRouterDevtoolsInProd />
</>
)
}
import { Link, Outlet, createRootRoute } from '@tanstack/solid-router'
import { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools'
import { NotFound } from '~/components/NotFound'
import appCss from '~/styles/app.css?url'
import { seo } from '~/utils/seo'
export const Route = createRootRoute({
head: () => ({
meta: [
{
name: 'viewport',
content: 'width=device-width, initial-scale=1',
},
...seo({
title:
'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework',
description: `TanStack Start is a type-safe, client-first, full-stack React framework. `,
}),
],
links: [
{ rel: 'stylesheet', href: appCss },
{
rel: 'apple-touch-icon',
sizes: '180x180',
href: '/apple-touch-icon.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '32x32',
href: '/favicon-32x32.png',
},
{
rel: 'icon',
type: 'image/png',
sizes: '16x16',
href: '/favicon-16x16.png',
},
{ rel: 'manifest', href: '/site.webmanifest', color: '#fffff' },
{ rel: 'icon', href: '/favicon.ico' },
],
}),
errorComponent: (props) => <p>{props.error.stack}</p>,
notFoundComponent: () => <NotFound />,
component: RootComponent,
})
function RootComponent() {
return (
<>
<div class="p-2 flex gap-2 text-lg">
<Link
to="/"
activeProps={{
class: 'font-bold',
}}
activeOptions={{ exact: true }}
>
Home
</Link>{' '}
<Link
to="/posts"
activeProps={{
class: 'font-bold',
}}
>
Posts
</Link>{' '}
<Link
to="/users"
activeProps={{
class: 'font-bold',
}}
>
Users
</Link>{' '}
<Link
to="/deferred"
activeProps={{
class: 'font-bold',
}}
>
Deferred
</Link>{' '}
<Link
to="/redirect"
activeProps={{
class: 'font-bold',
}}
>
redirect
</Link>{' '}
<Link
// @ts-expect-error
to="/this-route-does-not-exist"
activeProps={{
class: 'font-bold',
}}
>
This Route Does Not Exist
</Link>
</div>
<Outlet />
<TanStackRouterDevtoolsInProd />
</>
)
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.