replace-reactdom-render
Replace ReactDOM.render and named render imports with createRoot(...).render(...).
Usage
bash
Development
bash
Explore community-led codemods to migrate, optimize, and transform your codebase.
Build your own codemod and share it with the community.
Replace ReactDOM.render with createRoot for React 18
npx codemod @react-new/replace-reactdom-render
Replace ReactDOM.render and named render imports with createRoot(...).render(...).
bash
bash
This is one example from the codemod's test cases. The codemod may handle many more cases.
Build your own codemod and share it with the community.
1 import { render } from "react-dom";
2
3 describe("suite", () => {
4 const run = () => {
5 render(<Component />, theNode);
6 };
7 });
8