APIs

createRoot()

Creates a client React root for an existing DOM node. Returns the root object; use its render method to display UI. Use hydration instead for existing React server-rendered markup.

Formal Syntax & Structure

react syntaxreact
createRoot()

Working Example

Example Snippetreact
import { createRoot } from 'react-dom/client';const root = createRoot(document.getElementById('root'));
React Reference