mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-24 15:18:19 +00:00
[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:
@@ -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') }
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user