-
Notifications
You must be signed in to change notification settings - Fork 17
/
client.alpha.js
33 lines (26 loc) · 958 Bytes
/
client.alpha.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
/*global document, window */
import ReactDOM from 'react-dom';
import debug from 'debug';
import { createElementWithContext } from 'fluxible-addons-react';
import app from './app';
const debugClient = debug('slidewiki-platform');
const dehydratedState = window.App; // Sent from the server
window.React = ReactDOM; // For chrome dev tool support
// expose debug object to browser, so that it can be enabled/disabled from browser:
// https://github.com/visionmedia/debug#browser-support
window.fluxibleDebug = debug;
debugClient('rehydrating app');
// pass in the dehydrated server state from server.js
app.rehydrate(dehydratedState, (err, context) => {
if (err) {
throw err;
}
window.context = context;
const mountNode = document.getElementById('app');
debugClient('React Rendering');
ReactDOM.render(
createElementWithContext(context),
mountNode,
() => debugClient('React Rendered')
);
});