1- import React from 'react' ;
2- import ReactDOM from 'react-dom' ;
3- import './index.css' ;
4- import App from './App' ;
5- import * as serviceWorker from './serviceWorker' ;
6- import 'bootstrap/dist/css/bootstrap.min.css' ;
7- import { Provider } from "react-redux"
8- import { BrowserRouter } from 'react-router-dom'
9- import { persistStore , persistReducer } from "redux-persist" ;
10- import { PersistGate } from "redux-persist/integration/react" ;
11- import { createStore } from 'redux'
12- import storage from 'redux-persist/lib/storage' // defaults to localStorage for web
1+ import React from "react" ;
2+ import ReactDOM from "react-dom" ;
3+ import "./index.css" ;
4+ import App from "./App" ;
5+ import * as serviceWorker from "./serviceWorker" ;
6+ import "bootstrap/dist/css/bootstrap.min.css" ;
7+ import { Provider } from "react-redux" ;
8+ import { BrowserRouter } from "react-router-dom" ;
9+ import { persistStore , persistReducer } from "redux-persist" ;
10+ import { PersistGate } from "redux-persist/integration/react" ;
11+ import { createStore } from "redux" ;
12+ import storage from "redux-persist/lib/storage" ; // defaults to localStorage for web
13+ // all th reducer
1314import indexReducer from "./store/reducer/index" ;
1415
15-
16+ //PersistData
1617const persistConfig = {
17- key : ' root' ,
18+ key : " root" ,
1819 storage,
19- }
20-
21- const persistedReducer = persistReducer ( persistConfig , indexReducer )
22-
23- let store = createStore ( persistedReducer ,
24- window . __REDUX_DEVTOOLS_EXTENSION__ && window . __REDUX_DEVTOOLS_EXTENSION__ ( ) ,
25- )
20+ } ;
21+ const persistedReducer = persistReducer ( persistConfig , indexReducer ) ;
2622
23+ let store = createStore (
24+ persistedReducer ,
25+ //window dev extension
26+ window . __REDUX_DEVTOOLS_EXTENSION__ && window . __REDUX_DEVTOOLS_EXTENSION__ ( )
27+ ) ;
2728const persistor = persistStore ( store ) ;
2829
2930ReactDOM . render (
30- // we need to make the store available to our app.
31- // To do this, we wrap our app with the <Provider />
31+ // we need to make the store available to our app.
32+ // To do this, we wrap our app with the <Provider />
3233 // API provided by React Redux. store is passed in as a prop
33- < Provider store = { store } >
34- < PersistGate persistor = { persistor } >
35- < BrowserRouter >
34+
35+
36+ < Provider store = { store } > { /* Attach the store so all the component have acces */ }
37+ < PersistGate persistor = { persistor } > { /* Attach persit */ }
38+ < BrowserRouter > { /* Attach Router */ }
3639 < App />
3740 </ BrowserRouter >
3841 </ PersistGate >
3942 </ Provider > ,
40- document . getElementById ( ' root' )
43+ document . getElementById ( " root" )
4144) ;
4245
43-
4446// If you want your app to work offline and load faster, you can change
4547// unregister() to register() below. Note this comes with some pitfalls.
4648// Learn more about service workers: https://bit.ly/CRA-PWA
47- serviceWorker . unregister ( ) ;
49+ serviceWorker . unregister ( ) ;
0 commit comments