react-dom-to-react-dom-factories
Replace React.DOM.*(...) and DOM.*(...) factory calls with createElement(...).
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 React.DOM factories with createElement calls
npx codemod @react-new/react-dom-to-react-dom-factories
Replace React.DOM.*(...) and DOM.*(...) factory calls with createElement(...).
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 ReactDOM from 'ReactDOM';
2 import {
3 Component,
4 DOM
5 } from 'react';
6
7 class Hello extends Component {
8 render() {
9 return DOM.div(null, `Hello ${this.props.toWhat}`);
10 }
11 }
12