Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
13
rated 0 times [  16] [ 3]  / answers: 1 / hits: 14116  / 4 Years ago, wed, april 8, 2020, 12:00:00

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.


More From » reactjs

 Answers
3

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;

[#4226] Monday, April 6, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bradley

Total Points: 555
Total Questions: 102
Total Answers: 99

Location: Tajikistan
Member since Fri, Nov 27, 2020
4 Years ago
;