Miguel
Miguel

Reputation: 1656

React-query is not working with a project bootstrapped with Vite

I'm having a problem setting up my new project bootstrapped with Vite,

No QueryClient set, use QueryClientProvider to set one

The project crash when I add the component ReactQueryDevtools to the code. I tried bootstrapping an app with create-react-app and it worked with exactly the same code.

src/App.jsx :


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

import "./App.css";

const queryClient = new QueryClient();

function App() {
  return (
    <QueryClientProvider client={queryClient}>
      <ReactQueryDevtools initialIsOpen={false} />
      <h1>Root</h1>
    </QueryClientProvider>
  );
}

export default App;

Upvotes: 4

Views: 5660

Answers (1)

TkDodo
TkDodo

Reputation: 28938

It's an open issue related to the devtools. We are tracking it here: https://github.com/tannerlinsley/react-query/issues/1936

Upvotes: 1

Related Questions