-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.jsx
More file actions
38 lines (30 loc) · 874 Bytes
/
Copy pathmain.jsx
File metadata and controls
38 lines (30 loc) · 874 Bytes
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
import React, { PropTypes } from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { ReduxRouter } from 'redux-router';
import createStore from './reduxApp/create.jsx';
const getRoutes = require('./routes');
const Root = ({ store }) => (
<Provider store={store}>
<ReduxRouter>
{getRoutes(store)}
</ReduxRouter>
</Provider>
);
Root.propTypes = {
store: PropTypes.object.isRequired,
};
import { appStart } from 'reduxApp/modules/app';
window.onload = () => {
const root = document.getElementById('app');
try {
const store = createStore();
render((
<Root store={store} />
), root);
store.dispatch(appStart());
} catch (e) {
const RedBox = require('redbox-react').default;
render(<RedBox error={e} />, root);
}
};