Open History to see the last commit
1<script lang="ts">
2 import { 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 let {
11 dehydratedState,
12 queryFn,
13 }: {
14 dehydratedState: DehydratedState
15 queryFn: () => Promise<string>
16 } = $props()
17β
18 const queryClient = new QueryClient()
19 setQueryClientContext(queryClient)
20β
21 const query = createQuery(() => ({
22 queryKey: ['string'],
23 queryFn,
24 }))
25</script>
26β
27<HydrationBoundary
28 state={dehydratedState}
29 options={undefined}
30 queryClient={undefined}
31>
32 <div>data: {query.data ?? 'undefined'}</div>
33</HydrationBoundary>