-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
58 lines (50 loc) · 1.38 KB
/
index.js
File metadata and controls
58 lines (50 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import registerServiceWorker from './registerServiceWorker'
import 'bootstrap/dist/css/bootstrap.css'
import { createBrowserHistory } from 'history'
import {Provider} from 'react-redux'
import {createStore, applyMiddleware, compose} from 'redux'
import { Router } from 'react-router-dom'
import thunkMiddleware from 'redux-thunk'
import {persistStore, autoRehydrate} from 'redux-persist'
import reducers from './reducers'
import App from './App'
require('dotenv').load()
const history = createBrowserHistory()
let store = null
if (process.env.NODE_ENV === 'development') {
store = createStore(reducers, undefined, compose(
autoRehydrate(),
applyMiddleware(thunkMiddleware)
// window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
))
} else {
store = createStore(reducers, undefined, compose(
autoRehydrate(),
applyMiddleware(thunkMiddleware)
))
}
persistStore(store, {
whitelist: [
'userName',
'isPregnant',
'hasChildren',
'hasMidwife',
'dueDate',
'children',
'userRewardIds',
'pointsTotal',
'sectionIndex'
// add any keys from state to persist here
]
})
ReactDOM.render(
<Provider store={store}>
<Router history={history} >
<App />
</Router>
</Provider>,
document.getElementById('root'))
registerServiceWorker()