@@ -5,9 +5,6 @@ import './assets';
5
5
6
6
import React , { Component } from "react" ;
7
7
import { render } from "react-dom" ;
8
- import { Router , Route , IndexRoute , browserHistory , Link } from 'react-router' ;
9
-
10
- import NotFound from "./components/NotFound" ;
11
8
import Main from "./components/Main" ;
12
9
13
10
class App extends Component {
@@ -40,26 +37,20 @@ class App extends Component {
40
37
}
41
38
}
42
39
43
- global . renderClient = function ( ) {
44
- // const renderClient = (data) => {
45
- // const data = data || [] ;
40
+ global . renderClient = function ( json ) {
41
+ const posts = json || [ ] ;
42
+ // console.log('client posts', JSON.stringify(posts)) ;
46
43
return render (
47
- < Router history = { browserHistory } >
48
- < Route path = "/" component = { App } >
49
- < IndexRoute component = { Main } />
50
- < Route path = "home" component = { Main } />
51
- < Route path = "*" component = { NotFound } />
52
- </ Route >
53
- </ Router > ,
44
+ < App > < Main posts = { posts } /> </ App > ,
54
45
document . getElementById ( 'app' )
55
46
) ;
56
47
} ;
57
48
58
49
import { renderToString } from 'react-dom/server'
59
- global . renderServer = function ( ) {
60
- // const renderServer = (data) => {
61
- // const data = Java.from(data );
62
- return renderToString ( < App > < Main /> </ App > ) ;
50
+ global . renderServer = function ( java ) {
51
+ const posts = Java . from ( java || [ ] ) ;
52
+ // console.log('server posts', posts );
53
+ return renderToString ( < App > < Main posts = { posts } /> </ App > ) ;
63
54
} ;
64
55
65
56
import $ from 'jquery' ;
0 commit comments