-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
seems ok, but slow...need to fix the bug of react server-client rende…
…ring and then test it...
- Loading branch information
1 parent
b977431
commit 8510a89
Showing
5 changed files
with
197 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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') | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.