繁体   English   中英

Redux-Thunk 错误:store.dispatch(...).then 不是函数

[英]Redux-Thunk Error : store.dispatch(...).then is not a function

import ReactDOM from "react-dom/client";
import { Provider } from "react-redux";
import reportWebVitals from "./reportWebVitals";
import AppRouter from "./routers/AppRouter";
import "./App.css";
import configureStore from "./store/configureStore";
import { getBlogsToDatabase } from "./actions/blogAction";
import "./firebase/firebaseConfig";

const root = ReactDOM.createRoot(document.getElementById("root"));

const store = configureStore();

const result = (
  <Provider store={store}>
    <AppRouter />
  </Provider>
);

root.render(<p>Loading...</p>);

store.dispatch(getBlogsToDatabase()).then(() => {
  root.render(result);
});

在此处输入图像描述

使用我在一些帖子中看到的 Promise 构造时出现错误,这可能是 NPM 版本的问题。 在此先感谢您的帮助。

抱歉,dispatch 不是 Promise,你不能在它上面使用 then()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM