我试图在react中使用C#后端进行crud操作。问题是当我在index.js中导入store时,它显示:未找到模块:错误:无法解析“C:\Users\MrMe\Desktop\TEST\categorycrud3\src”中的“./Storage”
我的商店文件:
import React from "react";
import { configureStore, getDefaultMiddleware } from "@reduxjs/toolkit";
import { categoryApi } from "../Apis";
const store = configureStore({
reducer: {
[categoryApi.reducerPath]: categoryApi.reducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(categoryApi.middleware),
});
export default store;
我的Index.js文件:
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./Container/App";
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap/dist/js/bootstrap.bundle.min";
import { BrowserRouter } from "react-router-dom";
import { Provider } from "react-redux";
import { store } from "./Storage";
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<Provider store={store}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>
);
有人能告诉我哪里可能出错吗?
2条答案
按热度按时间63lcw9qa1#
idfiyjo82#
尝试更新
store
导入,因为它是export default
: