import { createFileRoute } from '@tanstack/react-router'
import * as React from 'react'
import { Link, Outlet } from '@tanstack/react-router'
export const Route = createFileRoute('/dashboard')({
component: DashboardComponent,
})
function DashboardComponent() {
return (
<>
<div className="flex items-center border-b">
<h2 className="text-xl p-2">Dashboard</h2>
</div>
<div className="flex flex-wrap divide-x">
{(
[
['/dashboard', 'Summary', true],
['/dashboard/invoices', 'Invoices'],
['/dashboard/users', 'Users'],
] as const
).map(([to, label, exact]) => {
return (
<Link
key={to}
to={to}
activeOptions={{ exact }}
activeProps={{ className: `font-bold` }}
className="p-2"
>
{label}
</Link>
)
})}
</div>
<hr />
<Outlet />
</>
)
}
import { createFileRoute } from '@tanstack/react-router'
import * as React from 'react'
import { Link, Outlet } from '@tanstack/react-router'
export const Route = createFileRoute('/dashboard')({
component: DashboardComponent,
})
function DashboardComponent() {
return (
<>
<div className="flex items-center border-b">
<h2 className="text-xl p-2">Dashboard</h2>
</div>
<div className="flex flex-wrap divide-x">
{(
[
['/dashboard', 'Summary', true],
['/dashboard/invoices', 'Invoices'],
['/dashboard/users', 'Users'],
] as const
).map(([to, label, exact]) => {
return (
<Link
key={to}
to={to}
activeOptions={{ exact }}
activeProps={{ className: `font-bold` }}
className="p-2"
>
{label}
</Link>
)
})}
</div>
<hr />
<Outlet />
</>
)
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.
