1
|
|
|
/* global window document */ |
2
|
|
|
|
3
|
|
|
import React from 'react'; |
4
|
|
|
import ReactDOM from 'react-dom'; |
5
|
|
|
import { AppContainer } from 'react-hot-loader'; |
6
|
|
|
|
7
|
|
|
import AppComponent from './component/App'; |
8
|
|
|
import './style/common.scss'; |
9
|
|
|
|
10
|
|
|
const appState = window.state; |
11
|
|
|
const App = React.createFactory(AppComponent); |
12
|
|
|
// const render = (Component) => { |
13
|
|
|
// ReactDOM.render( |
14
|
|
|
// //React.createElement(AppContainer, {}, Component), |
15
|
|
|
// (<AppContainer><Component /></AppContainer>), |
16
|
|
|
// document.getElementById('app-main') |
17
|
|
|
// ); |
18
|
|
|
// }; |
19
|
|
|
|
20
|
|
|
ReactDOM.render( |
21
|
|
|
//React.createElement(AppContainer, {}, Component), |
22
|
|
|
//(<AppContainer>{App(appState)}</AppContainer>), |
23
|
|
|
<AppContainer><AppComponent {...appState} /></AppContainer>, |
24
|
|
|
document.getElementById('app-main'), |
25
|
|
|
); |
26
|
|
|
|
27
|
|
|
//render(App(window.state)); |
28
|
|
|
|
29
|
|
|
if (module.hot) { |
30
|
|
|
module.hot.accept('./component/App', () => { |
31
|
|
|
//const AppNext = React.createFactory(require('./component/App')); |
32
|
|
|
//render(AppNext(window.state)); |
33
|
|
|
ReactDOM.render( |
34
|
|
|
//React.createElement(AppContainer, {}, Component), |
35
|
|
|
(<AppContainer><AppComponent {...appState} /></AppContainer>), |
36
|
|
|
document.getElementById('app-main'), |
37
|
|
|
); |
38
|
|
|
}); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/* global window document */ |
42
|
|
|
//require('./style/common.scss'); |
43
|
|
|
|
44
|
|
|
// const React = require('react'); |
45
|
|
|
// const ReactDOM = require('react-dom'); |
46
|
|
|
// const AppComponent = require('./component/App'); |
47
|
|
|
// |
48
|
|
|
// const App = React.createFactory(AppComponent); |
49
|
|
|
// const serverState = window.state; |
50
|
|
|
// |
51
|
|
|
// ReactDOM.render(App(serverState), document.getElementById('app-main')); |
52
|
|
|
// |
53
|
|
|
// if (module.hot) { |
54
|
|
|
// module.hot.accept(); |
55
|
|
|
// } |
56
|
|
|
|