root container
The existing page element, often <div id="root">, into which React renders an application.
In more detail
You pass it to createRoot, and React manages everything inside it. React also attaches its delegated event listeners to this element, so separate React roots on one page stay independent.
Related terms
- createRoot — The React DOM function that turns a page element into a React root, whose render method then displays a component inside it.
- event delegation — Handling events for many child elements with one listener on a shared ancestor, using event.target to find which child was involved.
Taught in
- SyntheticEvent System: Event Delegation in Modern React — React 19 & Modern Component Architecture
- useLayoutEffect vs useEffect: Painting And Synchronous Reads — React 19 & Modern Component Architecture
- Compound Components: Inversion of Control with Context — React 19 & Modern Component Architecture
- useId: Generating Stable Accessible Form Element Identifiers — React 19 & Modern Component Architecture
- React Portals: Escaping Stacking Contexts for Modals — React 19 & Modern Component Architecture