import {createStore, compose, applyMiddleware } from 'redux';
import reducer from './reducer';
import thunk from 'redux-thunk';
// persist store
import {persistStore, persistReducer} from 'redux-persist';
import storage from 'redux-persist/lib/storage';
const myPersistReducer = persistReducer({
key: 'root',
storage: storage,
}, reducer)
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(myPersistReducer,composeEnhancers(
applyMiddleware(thunk)
))
export const persistor = persistStore(store)
export default store
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import { Provider } from "react-redux"
import store from "./store"
import { persistor } from "./store"
import { PersistGate } from 'redux-persist/lib/integration/react'
ReactDOM.render(<Provider store={store}>
<PersistGate persistor={persistor}>
<App />
</PersistGate>
</Provider>, document.getElementById('root'));