MCPcopy Create free account
hub / github.com/TanStack/router / PostsLayoutComponent

Function PostsLayoutComponent

examples/react/basic/src/posts.lazy.tsx:8–36  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6})
7
8function PostsLayoutComponent() {
9 const posts = Route.useLoaderData()
10
11 return (
12 <div className="p-2 flex gap-2">
13 <ul className="list-disc pl-4">
14 {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map(
15 (post) => {
16 return (
17 <li key={post.id} className="whitespace-nowrap">
18 <Link
19 to="/posts/$postId"
20 params={{
21 postId: post.id,
22 }}
23 className="block py-1 px-2 text-blue-600 hover:opacity-75"
24 activeProps={{ className: 'font-bold underline' }}
25 >
26 <div>{post.title.substring(0, 20)}</div>
27 </Link>
28 </li>
29 )
30 },
31 )}
32 </ul>
33 <Outlet />
34 </div>
35 )
36}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected