-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathindex.js
32 lines (26 loc) · 871 Bytes
/
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
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import configureStore from './store/configureStore';
import { setQuery } from './actions';
import App from './containers/App';
import FriendSearchView from './containers/FriendSearchView';
const store = configureStore();
browserHistory.listen(location => {
if (location.action === 'POP') {
store.dispatch(setQuery(location.query.q));
}
});
// NOTE: react-router is not really needed for this example...
ReactDOM.render(
<Provider store={store}>
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={FriendSearchView} />
</Route>
</Router>
</Provider>,
document.getElementById('root')
);