forked from freeCodeCamp/pantry-for-good
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
54 lines (42 loc) · 1.32 KB
/
app.js
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
import React from 'react'
import ReactDOM from 'react-dom'
import {Provider} from 'react-redux'
import {AppContainer} from 'react-hot-loader'
import createHistory from 'history/createBrowserHistory'
import io from 'socket.io-client'
import createStore from './store'
import 'bootstrap/dist/css/bootstrap.min.css'
import 'font-awesome/css/font-awesome.css'
import 'admin-lte/dist/css/AdminLTE.min.css'
import 'admin-lte/dist/css/skins/skin-blue.min.css'
import 'jquery'
import 'admin-lte/plugins/slimScroll/jquery.slimscroll'
import 'admin-lte/plugins/fastclick/fastclick'
import './application.css'
import './modules/core/css/core.css'
import Application from './Application'
//disable redbox
delete AppContainer.prototype.unstable_handleError
const history = createHistory({})
const socket = process.env.NODE_ENV === 'production' ?
io() : io('http://localhost:3000')
const store = createStore(history, socket)
socket.on('action', store.dispatch)
const root = document.getElementById('app')
function render(Component) {
ReactDOM.render(
<AppContainer>
<Provider store={store}>
<Component history={history} />
</Provider>
</AppContainer>,
root
)
}
if (module.hot) {
module.hot.accept('./Application', () => {
const Next = require('./Application').default
render(Next)
})
}
render(Application)