hydrateRoot

ReactRoot hydrateRoot(

  1. JSObject container,
  2. ReactElement initialChildren
)

Creates a React root for hydrating server-rendered content (React 18+).

Use this instead of createRoot when hydrating a container whose HTML contents were rendered by ReactDOMServer.

Example:

final container = Document.getElementById('root')!;
final root = hydrateRoot(container, myApp);

Implementation

ReactRoot hydrateRoot(JSObject container, ReactElement initialChildren) =>
    _reactDomHydrateRoot(container, initialChildren);