This repository contains the public JSSG codemods for React migrations and cleanup work.
All codemods are free and open source, with the source code available in this repository.
npx codemod <codemod-name> --target <path><codemod-name>— name of the codemod (see available codemods below)<path>— files or directory to transform
Check Codemod docs for the full list of available commands.
All React codemods are also available in the Codemod Registry.
Runs all React 19 migration codemods in sequence.
npx codemod @react-new/react-19-migration-recipe --target <path>See @react-new/react-19-migration-recipe.
Replaces usages of React.useContext(...) with React.use(...).
npx codemod @react-new/use-context-hook --target <path>See @react-new/use-context-hook.
Updates act import path from react-dom/test-utils to react.
npx codemod @react-new/replace-act-import --target <path>See @react-new/replace-act-import.
Replaces deprecated string refs with callback refs.
npx codemod @react-new/replace-string-ref --target <path>See @react-new/replace-string-ref.
Replaces usages of useFormState() with useActionState().
npx codemod @react-new/replace-use-form-state --target <path>See @react-new/replace-use-form-state.
Replaces usages of ReactDOM.render() with createRoot(node).render().
npx codemod @react-new/replace-reactdom-render --target <path>See @react-new/replace-reactdom-render.
Replaces React.PropTypes references with the prop-types package and adds the appropriate import statement.
npx codemod @react-new/react-proptypes-to-prop-types --target <path>See @react-new/react-proptypes-to-prop-types.
create-element-to-jsxerror-boundariesfind-dom-nodemanual-bind-to-arrowpure-componentpure-render-mixinreact-dom-to-react-dom-factoriesreact-native-view-prop-typesreact-to-react-domremove-context-providerremove-forward-refrename-unsafe-lifecyclessort-compupdate-react-imports
pnpm install
pnpm run ciRun tests:
pnpm testRun type checking:
pnpm run check-typesIf you want to contribute, see CONTRIBUTING.md.