Capítulo 73 de 80
Retrieves the QueryClient from the nearest QueryClientProvider — the standard way to reach the client imperatively inside a component (for invalidateQueries, setQueryData, etc.), as opposed to declaratively via useQuery.
useQueryClient(queryClient?) — the optional argument overrides which client to return, otherwise resolves from context.const queryClient = useQueryClient()
queryClient.invalidateQueries({ queryKey: ['todos'] })
queryClient from inside a component — pair it with any imperative QueryClient method.