-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
39 lines (36 loc) · 1.4 KB
/
index.js
File metadata and controls
39 lines (36 loc) · 1.4 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
import './style/style.less'
import 'babel-core/polyfill'
import React from 'react'
import {render} from 'react-dom'
import {Provider} from 'react-redux'
import {Router,Route,IndexRoute} from 'react-router'
import configureStore, {history, reduxRouterMiddleware} from './store/configureStore'
import App from './containers/App'
import Home from './containers/Home'
//import About from './containers/About'
// import Archives from './containers/Archives'
// import ArchivesHome from './containers/ArchivesHome'
// import ArchivePage from './containers/ArchivePage'
const store = configureStore()
reduxRouterMiddleware.listenForReplays(store)
const loadPageAsync = pageName => (location, cb) => {
let bundle = require('bundle?lazy!./containers/' + pageName)
bundle(component => {
cb(null, component)
})
}
render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="about" getComponent={loadPageAsync('About')}/>
<Route path="archives" getComponent={loadPageAsync('Archives')}>
<IndexRoute getComponent={loadPageAsync('ArchivesHome')}/>
<Route path=":name" getComponent={loadPageAsync('ArchivePage')}/>
</Route>
</Route>
</Router>
</Provider>,
document.getElementById('root')
)