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

useHydrate.ts

14 lines321 Bytes

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