/** * WARNING: This entrypoint is only available starting with `react-dom@18.0.0-rc.1` */ // See https://github.com/facebook/react/blob/main/packages/react-dom/client.js to see how the exports are declared, import React = require("react"); export interface HydrationOptions { /** * Prefix for `useId`. */ identifierPrefix?: string; onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void; } export interface RootOptions { /** * Prefix for `useId`. */ identifierPrefix?: string; onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void; } export interface ErrorInfo { digest?: string; componentStack?: string; } export interface Root { render(children: React.ReactNode): void; unmount(): void; } /** * Replaces `ReactDOM.render` when the `.render` method is called and enables Concurrent Mode. * * @see https://reactjs.org/docs/concurrent-mode-reference.html#createroot */ export function createRoot(container: Element | DocumentFragment, options?: RootOptions): Root; /** * Same as `createRoot()`, but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer. * * React will attempt to attach event listeners to the existing markup. * * **Example Usage** * * ```jsx * hydrateRoot(document.querySelector('#root'), ) * ``` * * @see https://reactjs.org/docs/react-dom-client.html#hydrateroot */ export function hydrateRoot( container: Element | Document, initialChildren: React.ReactNode, options?: HydrationOptions, ): Root;