useQueryClient()

  • Trong react query, useQueryClient() là một hook cho phép ta truy cập đến instance QueryClient.

  • QueryClient là một instance quản lý toàn bộ queries và dữ liệu trong caches của app.

Khai báo:

import { useQueryClient } from '@tanstack/react-query'

// Lấy instance QueryClient từ context
const queryClient = useQueryClient()

Các thuộc tính, phương thức của useQueryClient()

Last updated