Skip to main content
InterviewHubPRO
Section Overview
Q40

Question 40 of 407

General

10%
React Core & Hooks (407 Qs)•General

What is the use of react-dom package?

junior LevelCode ExamplereactGeneral

The react-dom package provides DOM-specific methods that can be used at the top level of your app. Most of the components are not required to use this module. Some of the methods of this package are:

  1. render()
  2. hydrate()
  3. unmountComponentAtNode()
  4. findDOMNode()
  5. createPortal()

Practical Code Example

jsx
// react-dom: The glue between React core logic and browser DOM
import { createRoot } from 'react-dom/client';
import App from './App';

const container = document.getElementById('root');
const root = createRoot(container);
root.render(<App />);