[英]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.