解析错误:标识符已被声明

时间:2020-04-08 11:36:30

标签: javascript reactjs

我是React的初学者。我有一个项目,但无法正常运行。我安装了npm,启动后出现错误“解析错误:标识符'store'已经声明”。这是我的index.js

import "react-app-polyfill/ie11";
import "react-app-polyfill/stable";
import React from "react";
import ReactDOM from "react-dom";
import axios from "axios";
import { ToastContainer } from 'react-toastify';
import { mockAxios, setupAxios } from "./_metronic";
import store, { persistor } from "./app/store/store";
import store, { persistor } from "./app/redux/store";
import App from "./App";
import "./index.scss"; // Standard version
// import "./sass/style.react.rtl.css"; // RTL version
import "socicon/css/socicon.css";
import "@fortawesome/fontawesome-free/css/all.min.css";
import "./_metronic/_assets/plugins/line-awesome/css/line-awesome.css";
import "./_metronic/_assets/plugins/flaticon/flaticon.css";
import "./_metronic/_assets/plugins/flaticon2/flaticon.css";

import 'ag-grid-community/dist/styles/ag-grid.css';
import 'ag-grid-community/dist/styles/ag-theme-balham.css';

import "react-toastify/dist/ReactToastify.css";
/**
 * Base URL of the website.
 *
 * @see https://facebook.github.io/create-react-app/docs/using-the-public-folder
 */
const { PUBLIC_URL } = process.env;

/**
 * Creates `axios-mock-adapter` instance for provided `axios` instance, add
 * basic Metronic mocks and returns it.
 *
 * @see https://github.com/ctimmerm/axios-mock-adapter
 */
/* const mock = */ mockAxios(axios);

/**
 * Inject metronic interceptors for axios.
 *
 * @see https://github.com/axios/axios#interceptors
 */
setupAxios(axios, store);

ReactDOM.render(
  <>
    <App
      store={store}
      persistor={persistor}
      basename={PUBLIC_URL}
    />
    <ToastContainer autoClose={2000} />
  </>,
  document.getElementById("root")
);

我知道这肯定是基本的东西,但是找不到。

1 个答案:

答案 0 :(得分:0)

答案是在评论中,但为了清楚起见,其中之一必须更改或重命名。

import store, { persistor } from "./app/store/store";
import store, { persistor } from "./app/redux/store";