Created
May 23, 2023 01:52
-
-
Save dineshigdd/d65719aec646fdcf55562c9ce25bce7b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useQueryClient } from '@tanstack/react-query' | |
//creating queryClient object using useQueryClient hook | |
const queryClient = useQueryClient() | |
// Invalidate every query in the cache | |
queryClient.invalidateQueries() | |
// Invalidate every query with a key that starts with 'users' | |
queryClient.invalidateQueries({ queryKey: ['users'] }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment