Open History to see the last commit
1import { Link, createFileRoute } from '@tanstack/react-router'
2import { fetchPost } from '../utils/posts'
3import { PostErrorComponent } from './posts.$postId'
4β
5export const Route = createFileRoute('/posts_/$postId/deep')({
6 loader: async ({ params: { postId } }) => fetchPost(postId),
7 errorComponent: PostErrorComponent,
8 component: PostDeepComponent,
9})
10β
11function PostDeepComponent() {
12 const post = Route.useLoaderData()
13β
14 return (
15 <div className="p-2 space-y-2">
16 <Link
17 to="/posts"
18 className="block py-1 text-blue-800 hover:text-blue-600"
19 >
20 β All Posts
21 </Link>
22 <h4 className="text-xl font-bold underline">{post.title}</h4>
23 <div className="text-sm">{post.body}</div>
24 </div>
25 )
26}