Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

useHydrate.ts

18 lines355 Bytes

1import {
2 type HydrateOptions,
3 type QueryClient,
4 hydrate,
5} from '@tanstack/query-core'
6import { useQueryClient } from './useQueryClient'
7​
8export function useHydrate(
9 state?: unknown,
10 options?: HydrateOptions,
11 queryClient?: QueryClient,
12) {
13 const client = useQueryClient(queryClient)
14​
15 if (state) {
16 hydrate(client, state, options)
17 }