Files: d257f1cb78aa333ab6399429df9d754ce4f561f5 / app / client.js
958 bytesRaw
1 | const React = require('react') |
2 | const { render } = require('react-dom') |
3 | const { Provider } = require('react-redux') |
4 | const { Router } = require('react-router') |
5 | const { createHistory } = require('history') |
6 | const { syncReduxAndRouter } = require('redux-simple-router') |
7 | |
8 | const routes = require('app/routes') |
9 | const createStore = require('app/store') |
10 | const fetchElement = require('app/util/fetch-element') |
11 | |
12 | if (process.env.NODE_ENV === 'development') { |
13 | var DevTools = require('app/components/dev-tools') |
14 | } |
15 | |
16 | const store = createStore(window.__data) |
17 | const history = createHistory() |
18 | |
19 | syncReduxAndRouter(history, store) |
20 | |
21 | const component = ( |
22 | <Router createElement={fetchElement} history={history}> |
23 | { routes } |
24 | </Router> |
25 | ) |
26 | |
27 | render( |
28 | <Provider store={store} key="provider"> |
29 | <div> |
30 | { component } |
31 | { |
32 | (process.env.NODE_ENV === 'development') ? |
33 | <DevTools /> : null |
34 | } |
35 | </div> |
36 | </Provider>, |
37 | document.querySelector('main') |
38 | ) |
39 |
Built with git-ssb-web