()
| 7 | import { queryExampleAction } from './_action' |
| 8 | |
| 9 | export default function Home() { |
| 10 | const queryClient = makeQueryClient() |
| 11 | |
| 12 | queryClient.prefetchQuery({ |
| 13 | queryKey: ['data'], |
| 14 | queryFn: async () => { |
| 15 | const { count } = await ( |
| 16 | await fetch('http://localhost:3000/count', { |
| 17 | headers: await headers(), |
| 18 | }) |
| 19 | ).json() |
| 20 | |
| 21 | return { |
| 22 | text: 'data from server', |
| 23 | date: Temporal.PlainDate.from('2024-01-01'), |
| 24 | count, |
| 25 | } |
| 26 | }, |
| 27 | }) |
| 28 | |
| 29 | const state = dehydrate(queryClient) |
| 30 | |
| 31 | return ( |
| 32 | <main> |
| 33 | <HydrationBoundary state={state}> |
| 34 | <ClientComponent /> |
| 35 | </HydrationBoundary> |
| 36 | <form action={queryExampleAction}> |
| 37 | <button type="submit">Increment</button> |
| 38 | </form> |
| 39 | </main> |
| 40 | ) |
| 41 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…