Open History to see the last commit
1<script lang="ts">
2 import {
3 createQuery,
4 QueryClient,
5 type CreateQueryOptions,
6 type WritableOrVal,
7 } from '../index'
8 import { setQueryClientContext } from '../context'
9β
10 export let options: WritableOrVal<CreateQueryOptions<any>>
11β
12 const queryClient = new QueryClient()
13 setQueryClientContext(queryClient)
14β
15 const query = createQuery(options)
16</script>
17β
18{#if $query.isPending}
19 <p>Loading</p>
20{:else if $query.isError}
21 <p>Error</p>
22{:else if $query.isSuccess}
23 <p>Success</p>
24{/if}
25β
26<ul>
27 {#each $query.data ?? [] as entry}
28 <li>id: {entry.id}</li>
29 {/each}
30</ul>