ReactJS unmountComponentAtNode() Method Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report React.js library is all about splitting the app into several components. Each Component has its own lifecycle. React provides us with some in-built methods that we can override at particular stages in the life-cycle of the component. In class-based components, the unmountComponentAtNode() method Remove a mounted React component from the DOM. Creating React Application: Step 1: Create a React application using the following command.npx create-react-app foldernameStep 2: After creating your project folder i.e. foldername, move to it using the following command.cd foldernameProject Structure: It will look like the following. Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code. App.js import React from 'react' import ReactDOM from 'react-dom'; // Exporting your App Component export default function App() { // Function to unmount root component function unm() { ReactDOM.unmountComponentAtNode(document.getElementById("root")); } return ( <div> <h1>GeeksforGeeks</h1> <div>Hi Geek, this is the rendered content</div> <button onClick={unm}>Unmount</button> </div> ); } Step to Run Application: Run the application using the following command from the root directory of the project: npm startOutput: Now open your browser and go to http://localhost:3000/, you will see the following output: Reference: https://18.react.dev/reference/react-dom/unmountComponentAtNode Create Quiz Comment D dheerchanana2002 Follow 0 Improve D dheerchanana2002 Follow 0 Improve Article Tags : Web Technologies ReactJS ReactJS-Methods Explore React FundamentalsReact Introduction6 min readReact Environment Setup3 min readReact JS ReactDOM2 min readReact JSX5 min readReactJS Rendering Elements3 min readReact Lists4 min readReact Forms4 min readReactJS Keys4 min readComponents in ReactReact Components4 min readReactJS Functional Components4 min readReact Class Components3 min readReactJS Pure Components4 min readReactJS Container and Presentational Pattern in Components2 min readReactJS PropTypes5 min readReact Lifecycle7 min readReact HooksReact Hooks8 min readReact useState Hook5 min readReactJS useEffect Hook5 min readRouting in ReactReact Router5 min readReact JS Types of Routers10 min read Advanced React ConceptsLazy Loading in React and How to Implement it ?4 min readReactJS Higher-Order Components5 min readCode Splitting in React4 min readReact ProjectsCreate ToDo App using ReactJS3 min readCreate a Quiz App using ReactJS4 min readCreate a Coin Flipping App using ReactJS3 min readHow to create a Color-Box App using ReactJS?4 min readDice Rolling App using ReactJS4 min readGuess the number with React3 min read Like