[change] Configure hydration using AppRegistry.runApplication()

Client-side hydration of server-rendered HTML now requires that `hydrate` is explicitly set in the `appParams` passed to `AppRegistry.runApplication()`.

Fix #1374
This commit is contained in:
Nicolas Gallagher
2019-11-12 16:54:51 -08:00
parent e4ed0fd3c8
commit afb8d3b7fb
4 changed files with 31 additions and 18 deletions
@@ -76,15 +76,17 @@ AppRegistry.registerRunnable('MyApp', (appParams) => { ... });
### runApplication(appKey, appParams)
Runs the application that was registered under `appKey`. The `appParameters` must
include the `rootTag` into which the application is rendered, and optionally any
`initialProps` or render callback.
Runs the application that was registered under `appKey`. The `appParameters`
must include the `rootTag` into which the application is rendered, and
optionally any `initialProps` or render callback. If the client should hydrate
server-rendered HTML, set `hydrate` to `true`.
```js
AppRegistry.runApplication('MyApp', {
callback: () => { console.log('React rendering has finished') },
hydrate: true,
initialProps: {},
rootTag: document.getElementById('react-root'),
callback: () => { console.log('React rendering has finished') }
})
```