Open History to see the last commit
1<script lang="ts">
2 import type { QueryClient } from '@tanstack/query-core'
3 import {
4 HydrationBoundary,
5 createQuery,
6 setQueryClientContext,
7 } from '../../src/index.js'
8 import type { DehydratedState } from '@tanstack/query-core'
9β
10 type Props = {
11 queryClient: QueryClient
12 dehydratedState: DehydratedState
13 queryFn: () => Promise<string>
14 }
15β
16 let { queryClient, dehydratedState, queryFn }: Props = $props()
17β
18 setQueryClientContext(queryClient)
19β
20 const query = createQuery(() => ({
21 queryKey: ['string'],
22 queryFn,
23 }))
24</script>
25β
26<HydrationBoundary
27 state={dehydratedState}
28 options={undefined}
29 queryClient={undefined}
30>
31 <div>data: {query.data ?? 'undefined'}</div>
32</HydrationBoundary>