SOLVED: TypeError: Cannot read property 'queries' of undefined

Published on 30 Jul, 2021

I am learning how to use React Query Dev Tools. When followed the tutorial, I faced this issue TypeError: Cannot read property 'queries' of undefined. As per the tutorial, they are importing ReactQueryDevtools from react-query-devtools package.

import { ReactQueryDevtools } from "react-query-devtools";

If we are working with React Query v3, we need to import from different package.

import { ReactQueryDevtools } from "react-query/devtools";

and then add <ReactQueryDevtools /> immediately under QueryClientProvider.

<QueryClientProvider client={queryClient}>
  <GitUsers />
  <ReactQueryDevtools />
</QueryClientProvider>