File tree Expand file tree Collapse file tree 3 files changed +9
-24
lines changed Expand file tree Collapse file tree 3 files changed +9
-24
lines changed Original file line number Diff line number Diff line change 1
- import React , { Component , ReactElement } from 'react' ;
2
- import ReactDOM from 'react-dom' ;
3
- import { AppContainer } from 'react-hot-loader' ;
4
- import Layout from './layout' ;
5
-
6
- export default function bootstrap ( App ) {
7
- if ( EASY_ENV_IS_NODE ) {
8
- return props => < Layout { ...props } > < App { ...props } /> </ Layout > ;
9
- }
10
- const state = window . __INITIAL_STATE__ ;
11
- const root = document . getElementById ( 'app' ) ;
12
- if ( EASY_ENV_IS_DEV ) {
13
- const render = c => {
14
- ReactDOM . hydrate ( < AppContainer > < App { ...state } /> </ AppContainer > , root ) ;
15
- } ;
16
- render ( App ) ;
17
- if ( module . hot ) {
18
- module . hot . accept ( ) ;
19
- }
20
- }
21
- return ReactDOM . hydrate ( < App { ...state } /> , root ) ;
22
- }
Original file line number Diff line number Diff line change @@ -5,10 +5,17 @@ import { AppContainer } from 'react-hot-loader';
5
5
import Layout from '../../framework/layout' ;
6
6
// https://github.com/gaearon/react-hot-loader/issues/525
7
7
import { Tab } from './component/tab' ;
8
+ import { TabProps } from '../../framework/type' ;
9
+
10
+ class App extends Component < TabProps , any > {
11
+ render ( ) {
12
+ return < Layout { ...this . props } > < Tab { ...this . props } /> </ Layout > ;
13
+ }
14
+ }
8
15
9
16
function bootstrap ( ) {
10
17
if ( EASY_ENV_IS_NODE ) {
11
- return props => < Layout { ... props } > < Tab { ... props } /> </ Layout > ;
18
+ return App ;
12
19
}
13
20
const state = window . __INITIAL_STATE__ ;
14
21
const root = document . getElementById ( 'app' ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " egg-react-typescript-boilerplate" ,
3
- "version" : " 3.0.0 " ,
3
+ "version" : " 3.0.1 " ,
4
4
"description" : " 基于 egg + react + typescript + webpack 服务端渲染工程骨架项目" ,
5
5
"scripts" : {
6
6
"start" : " egg-scripts start" ,
You can’t perform that action at this time.
0 commit comments