createRoot

The React DOM function that turns a page element into a React root, whose render method then displays a component inside it.

In more detail

createRoot enables the concurrent features of React 18 and later. Call it once per root container, then call root.render with your top component; root.unmount removes everything again.

Example

createRoot(document.getElementById("root")).render(<App />);

Related terms

Taught in

References