reactjs 404 Not Found

2g32fytz  于 2023-03-29  发布在  React
关注(0)|答案(2)|浏览(118)

我试图在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>
);

有人能告诉我哪里可能出错吗?

63lcw9qa

63lcw9qa1#

File struture:
src:
   Apis:
       categoryAPI.js
   Container:
       App.jsx
   Layout:
       Header.jsx
       Footer.jsx
   Pages:
       Category.jsx
       Home.jsx
   Storage:
       store.js
   index.js
idfiyjo8

idfiyjo82#

尝试更新store导入,因为它是export default

import store from "./Storage/store";

相关问题