Codemod verified
Regularly tested and maintained by our engineers and codemod expert community.
migration
by
 Codemod
Codemod
React/19/Replace Reactdom Render
Last update
Sep 12, 2025
- Replaces usages of ReactDom.render()withcreateRoot(node).render().
- Replaces usages of ReactDom.hydrate()withhydrateRoot()
- Replaces usages of ReactDom.unmountComponentAtNode()withroot.unmount()
Example
Before
import ReactDom from "react-dom";import Component from "Component";ReactDom.render(<Component />, document.getElementById('app'));
After
import { createRoot } from "react-dom/client";import ReactDom from "react-dom";import Component from "Component";const root = createRoot(document.getElementById('app'));root.render(<Component />);
Before
import ReactDom from "react-dom";import Component from "Component";ReactDom.hydrate(<Component />, document.getElementById("app"));
After
import { hydrateRoot } from "react-dom/client";import ReactDom from "react-dom";import Component from "Component";hydrateRoot(document.getElementById("app"), <Component />);
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community