Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 640 Bytes

hydrateRoot.md

File metadata and controls

27 lines (19 loc) · 640 Bytes

hydrateRoot(container, element[, options])

Enable SSR mode then hydrate a container with the given element

Syntax

if (typeof(window) === 'object') {
  hydrateRoot(document.getElementById('root'), <App />);
} else {
  renderToServer(<App />);
}

Parameters

  • container - <DOMElement>
  • element - <ReactElement>
  • options - <object>
  • return <ReactRoot>

Notes

options are passed unmodified to React-DOM's hydrateRoot.

You can use renderToInnerHTML to simulate server generated contents during development.