[fix] use ReactDOM.hydrate in AppRegistry.runApplication

Allows AppRegistry to hydrate server-side rendered apps.

Fix #733
This commit is contained in:
Nicolas Gallagher
2017-12-18 16:15:47 +00:00
parent 9bcc67e73a
commit 82c044ee33
2 changed files with 14 additions and 2 deletions
+2 -2
View File
@@ -10,7 +10,7 @@
*/
import invariant from 'fbjs/lib/invariant';
import { render } from 'react-dom';
import { hydrate } from '../../modules/hydrate';
import AppContainer from './AppContainer';
import StyleSheet from '../../apis/StyleSheet';
import React, { type ComponentType } from 'react';
@@ -22,7 +22,7 @@ export default function renderApplication<Props: Object>(
) {
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);
render(
hydrate(
<AppContainer rootTag={rootTag}>
<RootComponent {...initialProps} />
</AppContainer>,
+12
View File
@@ -0,0 +1,12 @@
/**
* Copyright (c) 2016-present, Nicolas Gallagher.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
*/
import { hydrate } from 'react-dom';
export default hydrate;