-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
28 lines (24 loc) · 1021 Bytes
/
main.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
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore, applyMiddleware } from 'redux';
import { browserHistory, Router, Route, IndexRoute } from 'react-router';
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux';
import { Provider } from 'react-redux';
import allReducers from './reducers/index';
import App from './components/App';
import Home from './pages/Home';
import UserAdd from './pages/UserAdd';
import NotFound from './pages/NotFound'
let middleware = applyMiddleware(routerMiddleware(browserHistory));
const store = createStore(allReducers, middleware);
const history = syncHistoryWithStore(browserHistory, store)
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="user-add(/:id)" component={UserAdd}/>
<Route path="*" component={NotFound}/>
</Route>
</Router>
</Provider>, document.getElementById('root'));