admin管理员组

文章数量:1405388

I have this in my store.js:

import { configureStore } from "@reduxjs/toolkit";
import userReducer from "../features/userSlice";

export default configureStore({
  reducer: {
    user: userReducer,
  },
});

What am I supposed to import in index.js?
It shows: Attempted import error: 'configureStore' is not exported from './app/store'

import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import { configureStore } from "./app/store";
import { Provider } from "react-redux";

ReactDOM.render(
  <React.StrictMode>
  Provider configureStore={configureStore}>
  <App/>
  </Provider>
  </React.StrictMode>,
  document.getElementById("root")
);

I have this in my store.js:

import { configureStore } from "@reduxjs/toolkit";
import userReducer from "../features/userSlice";

export default configureStore({
  reducer: {
    user: userReducer,
  },
});

What am I supposed to import in index.js?
It shows: Attempted import error: 'configureStore' is not exported from './app/store'

import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import { configureStore } from "./app/store";
import { Provider } from "react-redux";

ReactDOM.render(
  <React.StrictMode>
  Provider configureStore={configureStore}>
  <App/>
  </Provider>
  </React.StrictMode>,
  document.getElementById("root")
);
Share Improve this question edited Sep 4, 2021 at 13:46 Jorenar 2,8845 gold badges29 silver badges63 bronze badges asked Sep 4, 2021 at 12:11 Digamber negiDigamber negi 4693 gold badges7 silver badges25 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 7

You are doing default export for configureStore, so you will need to import default it in other files

import { configureStore } from "./app/store";

TO

import configureStore from "./app/store";

Or store as it is remended not to conflict with configureStore from redux-toolkit

import store from "./app/store";

You're using default export. Either default import like

import configureStore from "./app/store"

or remove the default keyword from your export.

本文标签: javascriptAttempted import error 39configureStore39 is not exported from 39appstore39Stack Overflow