mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
[fix] ReactDOM hydration warnings in development
Don't try to hydrate from SSR HTML during development. Fix #745
This commit is contained in:
@@ -9,12 +9,15 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import AppContainer from './AppContainer';
|
||||
import invariant from 'fbjs/lib/invariant';
|
||||
import hydrate from '../../modules/hydrate';
|
||||
import AppContainer from './AppContainer';
|
||||
import render from '../../modules/render';
|
||||
import StyleSheet from '../../apis/StyleSheet';
|
||||
import React, { type ComponentType } from 'react';
|
||||
|
||||
const renderFn = process.env.NODE_ENV !== 'production' ? render : hydrate;
|
||||
|
||||
export default function renderApplication<Props: Object>(
|
||||
RootComponent: ComponentType<Props>,
|
||||
initialProps: Props,
|
||||
@@ -22,7 +25,7 @@ export default function renderApplication<Props: Object>(
|
||||
) {
|
||||
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);
|
||||
|
||||
hydrate(
|
||||
renderFn(
|
||||
<AppContainer rootTag={rootTag}>
|
||||
<RootComponent {...initialProps} />
|
||||
</AppContainer>,
|
||||
|
||||
Reference in New Issue
Block a user