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

Viewed 2335

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;
1 Answers
Related