1

I installed the react query devtools and I got an error when trying to start the app, the code and the error snapshots are above, any help, thank you. `

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import { QueryClient, QueryClientProvider } from 'react-query';
import reportWebVitals from './reportWebVitals';
import { ReactQueryDevtools } from 'react-query-devtools';

const queryClient = new QueryClient();

ReactDOM.render(
  <React.StrictMode>
    <QueryClientProvider client={queryClient}>
      {' '}
      <App />
      <ReactQueryDevtools initialIsOpen />
    </QueryClientProvider>
  </React.StrictMode>,
  document.getElementById('root')
);

reportWebVitals();
TypeError: Cannot read property 'queries' of undefined

 export const ReactQueryDevtoolsPanel = React.forwardRef(
> 215 |   function ReactQueryDevtoolsPanel(props, ref) {
  216 |     const { setIsOpen, ...panelProps } = props
  217 | 
  218 |     const queryCache = useQueryCache ? useQueryCache() : cache

3 Answers 3

3

Judging from the code, you are using react-query v3. The separate react-query-devtools package is for v2 only. With v3, please use the devtools that come with react-query:

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

Sign up to request clarification or add additional context in comments.

Comments

0

Write these import statement

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

write these before QueryClientProvider

<ReactQueryDevtools initialIsOpen={false} position="bottom-right" />

2 Comments

keeping initialIsOpen false or true is your choice and position also depends on requirement
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-2

I think this is has a simple solution! you forgot to assign a value to initialIsOpen, if it doesnt have one yet try assigning it an empty string

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.