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