forked from annawchou/fluxible.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.js
32 lines (25 loc) · 807 Bytes
/
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
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
/*global document, window */
import React from 'react';
import app from './app';
import Debug from 'debug';
import { batchedUpdatePlugin, createElementWithContext } from 'fluxible-addons-react';
// Add batched update plugin on client only
app.plug(batchedUpdatePlugin());
const dehydratedState = window.App; // sent from the server
// for chrome dev tool support
window.React = React;
window.app = app;
window.fluxibleDebug = Debug;
app.rehydrate(dehydratedState, function (err, context) {
if (err) {
throw err;
}
window.context = context;
React.render(createElementWithContext(context),
document.getElementById('docsapp')
);
});