May 2025posted on 05.13.2025Remove React app from the DOM Use ReactDOM.unmountComponentAtNode() (React < 18) or root.unmount() to remove a React app from the DOM. import ReactDOM from 'react-dom'; const domNode = document.getElementById('root'); ReactDOM.render(<App />, domNode); ReactDOM.unmountComponentAtNode(domNode); import { createRoot } from 'react-dom/client'; const domNode = document.getElementById('root'); const root = createRoot(domNode); root.render(<App />); root.unmount(); No reactions yet
Remove React app from the DOM
Use ReactDOM.unmountComponentAtNode() (React < 18) or root.unmount() to remove a React app from the DOM.