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

Function PostsLayoutComponent

examples/react/basic-react-query/src/posts.lazy.tsx:10–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected