createRoot
Creates a root to render a React tree into a browser DOM node.
Syntax
const root = createRoot(domNode, options?) Parameters
| Name | Type | Required | Description |
|---|---|---|---|
domNode | Element | Yes | A DOM element that will become the React root container. |
options | object | No | Optional config such as onUncaughtError and identifierPrefix. |
Returns
object — A root object with render and unmount methods.
Examples
import { createRoot } from 'react-dom/client';
const root = createRoot(document.getElementById('root'));
root.render(<App />);
root.unmount();
Notes
The React 18+ client entry point, replacing the legacy ReactDOM.render. It
enables concurrent features. Call createRoot once per container and reuse the
root for subsequent render calls. Use hydrateRoot instead for
server-rendered HTML.