-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathindex.js
63 lines (52 loc) · 1.4 KB
/
index.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
55
56
57
58
59
60
61
62
63
import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import {createStore, applyMiddleware} from 'redux';
import thunk from 'redux-thunk';
import createLogger from 'redux-logger';
import {AppContainer} from 'react-hot-loader';
import weatherApp from './reducers';
import App from './components/App';
import './icons/css/weather-icons.css';
import ons from 'onsenui';
import 'onsenui/css/onsenui.css';
import './stylus/index.styl';
const logger = createLogger();
const store = createStore(weatherApp,
window.devToolsExtension ? window.devToolsExtension() : f => f,
process.env.NODE_ENV === 'production'
? applyMiddleware(thunk)
: applyMiddleware(thunk, logger)
);
import {addLocationAndFetchWeather} from './actions';
[
'Tokyo',
'New York',
'London',
'Beijing',
'Sydney',
'Rio de Janeiro',
'Istanbul'
].forEach((city) => store.dispatch(addLocationAndFetchWeather(city)));
const rootElement = document.getElementById('root');
ons.ready(() => render(
<AppContainer>
<Provider store={store}>
<App />
</Provider>
</AppContainer>,
rootElement
));
if (module.hot) {
module.hot.accept('./components/App', () => {
const NextApp = require('./components/App').default;
render(
<AppContainer>
<Provider store={store}>
<NextApp />
</Provider>
</AppContainer>,
rootElement
);
});
}