Reputation: 65
I'm highly beginner at React. I got a project but can't run it properly. I did npm install and after start it gives an error "Parsing error: Identifier 'store' has already been declared". Here is my 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")
);
I know it's something basic for sure but couldn't find it.
Upvotes: 3
Views: 17757
Reputation: 662
The answer is in a comment, but just to make it perfectly clear one of these has to go or be renamed.
import store, { persistor } from "./app/store/store";
import store, { persistor } from "./app/redux/store";
Upvotes: 2