-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.js
41 lines (31 loc) · 1.03 KB
/
client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/** @jsx React.DOM */
// require('node-jsx').install({extension: '.jsx'});
var React = require('react');
var app = require('./app.js');
// window.React = React;
// var SkinnyBannerComponent = require('../../Components/skinnyBannerComponent.react.jsx');
// var pp_pageApp = require('../../Components/pp_pageApp.react.jsx');
var dehydratedState = JSON.parse(document.getElementById('initial-state').innerHTML);
// console.log('dehydratedState: ',dehydratedState);
console.log('check here')
app.rehydrate(dehydratedState, function(err, context){
if(err){
console.log('app.rehydrate err: ',err)
throw err;
}
// window.context = context;
var mountNode = document.getElementById('loader');
var Component = app.getComponent();
React.render(
Component({ context: context.getComponentContext() }),
mountNode,
function(){
console.log('React client-side rendered');
}
);
});
// console.log('state: ',state);
// React.renderComponent(
// <SkinnyBannerComponent/>,
// document.getElementById('skinnyBanner')
// );