【问题标题】:React-query is not working with a project bootstrapped with ViteReact-query 不适用于使用 Vite 引导的项目
【发布时间】:2021-06-07 18:01:09
【问题描述】:

我在设置使用 Vite 引导的新项目时遇到问题,

No QueryClient set, use QueryClientProvider to set one

当我将组件ReactQueryDevtools 添加到代码中时项目崩溃。我尝试使用 create-react-app 引导应用程序,它使用完全相同的代码。

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;

【问题讨论】:

标签: javascript reactjs react-query


【解决方案1】:

这是一个与开发工具相关的未解决问题。我们在这里跟踪它:https://github.com/tannerlinsley/react-query/issues/1936

【讨论】:

    猜你喜欢
    • 2021-07-30
    • 2022-08-04
    • 2019-02-03
    • 2023-02-01
    • 1970-01-01
    • 2018-06-02
    • 2022-10-07
    • 2021-05-23
    • 1970-01-01
    相关资源
    最近更新 更多