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

Function PostsLayoutComponent

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected