git ssb

1+

dinoworm ๐Ÿ› / catstack



Tree: 8ff89763aa5a55ca923acb5f2228036e30440737

Files: 8ff89763aa5a55ca923acb5f2228036e30440737 / app / render-browser.js

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

Built with git-ssb-web