()
| 13 | } |
| 14 | |
| 15 | export default function App() { |
| 16 | const [users, { mutate, refetch }] = |
| 17 | createResource<UserWithPosts[]>(fetchUsers) |
| 18 | |
| 19 | return ( |
| 20 | <main class="w-full flex flex-col items-center justify-center my-16 max-w-lg mx-auto space-y-16"> |
| 21 | <h1 class="text-blue-600 uppercase text-6xl w-fit font-thin leading-tight mx-auto"> |
| 22 | SolidJS + Prisma |
| 23 | </h1> |
| 24 | <div class="w-full flex flex-col items-center justify-center gap-4"> |
| 25 | <Show when={!users.loading} fallback={<p>Loading...</p>}> |
| 26 | <Show when={!users.error} fallback={<p>Error loading data</p>}> |
| 27 | <For each={users()}> |
| 28 | {(user) => ( |
| 29 | <div class="w-full p-4 border rounded-md"> |
| 30 | <h3 class="text-xl font-bold">{user.name}</h3> |
| 31 | <For each={user.posts}> |
| 32 | {(post) => ( |
| 33 | <div class="w-full gap-2"> |
| 34 | <a |
| 35 | href={post.content ?? ''} |
| 36 | class="text-blue-600 hover:underline" |
| 37 | > |
| 38 | {post.title} |
| 39 | </a> |
| 40 | </div> |
| 41 | )} |
| 42 | </For> |
| 43 | </div> |
| 44 | )} |
| 45 | </For> |
| 46 | </Show> |
| 47 | </Show> |
| 48 | </div> |
| 49 | <Socials /> |
| 50 | </main> |
| 51 | ) |
| 52 | } |
nothing calls this directly
no outgoing calls
no test coverage detected