git ssb

1+

dinoworm ๐Ÿ› / catstack



Tree: b0260714125b1a814ed76eaca838d164ae23101d

Files: b0260714125b1a814ed76eaca838d164ae23101d / app / render-browser.js

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

Built with git-ssb-web