File size: 384 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { hydrate } from '@tanstack/query-core'
import { useQueryClient } from './useQueryClient.js'
import type { HydrateOptions, QueryClient } from '@tanstack/query-core'

export function useHydrate(
  state?: unknown,
  options?: HydrateOptions,
  queryClient?: QueryClient,
) {
  const client = useQueryClient(queryClient)

  if (state) {
    hydrate(client, state, options)
  }
}