whatisgithub

What is react-codemod?

acdlite/react-codemod — explained in plain English

Analysis updated 2026-08-03 · repo last pushed 2017-04-14

2JavaScriptAudience · developerComplexity · 3/5DormantSetup · moderate

In one sentence

A collection of scripts that automatically rewrite old React code to use modern patterns, like converting React.createClass to ES6 classes or updating API calls, so you don't have to update hundreds of files by hand.

Mindmap

mindmap
  root((repo))
    What it does
      Rewrites old React code
      Converts to ES6 classes
      Updates deprecated APIs
      Dry run preview mode
    How it works
      Parses JavaScript files
      Finds old patterns
      Swaps with modern syntax
      Skips unsafe conversions
    Use cases
      Modernize large codebases
      Convert createClass to ES6
      Update createElement calls
      Reorder component methods
    Audience
      React developers
      Legacy code maintainers
      Facebook origin scripts
      Community driven fixes
    Tech stack
      JavaScript
      Codemod framework
      Babel parser
      CLI tools

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Modernize a large React codebase by converting React.createClass components to ES6 class syntax.

USE CASE 2

Update old React.createElement calls to modern JSX syntax across an entire project in one pass.

USE CASE 3

Preview code transformations with a dry run before committing changes to your repository.

USE CASE 4

Reorder component lifecycle methods to match a consistent style guide automatically.

What is it built with?

JavaScriptReactBabelCodemod

How does it compare?

acdlite/react-codemod3imed-jaberi/cryptography-si-isamm3imed-jaberi/koa-isomorphic-router
Stars222
LanguageJavaScriptJavaScriptJavaScript
Last pushed2017-04-142021-09-252021-02-06
MaintenanceDormantDormantDormant
Setup difficultymoderateeasyeasy
Complexity3/51/52/5
Audiencedeveloperresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires installing jscodeshift and understanding which transform matches your React version upgrade path.

No license information is provided in the explanation, so the licensing terms are unknown.

So what is it?

React-codemod is a toolkit for automatically updating React code when the React API changes. Instead of manually finding and rewriting dozens or hundreds of files every time React introduces a new pattern or deprecates an old one, you run one of these scripts and it rewrites the code for you. The scripts work by parsing your JavaScript files, identifying specific patterns, like calls to React.createElement or older ways of accessing DOM nodes, and replacing them with the modern equivalent, such as JSX syntax or React.findDOMNode. You point a script at a directory, and it walks through your code making the swaps. Some transforms also reorder methods in a component to match a style guide, or convert old class definitions into newer ES6 class syntax. You can do a dry run first to preview the changes before committing to them. The main audience is developers maintaining React applications that were written against older versions of the library and now need to modernize. For example, if you have a large codebase full of React.createClass components and want to move to ES6 classes, the class transform handles the heavy lifting, pulling out statics, converting getInitialState, rewriting method bindings, and so on. It is deliberately conservative: if it sees deprecated API calls or patterns it cannot safely convert, it skips that component rather than guessing and breaking things. The project is community-driven and explicitly not officially maintained. The scripts were originally used inside Facebook or contributed by community members, and fixes rely on pull requests rather than dedicated maintainers. The README also notes that after running the React-to-React-DOM transform, you may still need a separate regex-based find-and-replace to clean up whitespace between import statements.

Copy-paste prompts

Prompt 1
I have a React codebase using React.createClass. Write me the exact jscodeshift command to run the class transform from react-codemod to convert all my components to ES6 classes.
Prompt 2
After running the react-codemod React-to-React-DOM transform, I need a regex-based find-and-replace to clean up whitespace between import statements. Help me write that regex.
Prompt 3
Help me set up react-codemod to do a dry run on my src directory so I can preview what changes the createElement-to-JSX transform would make before committing.
Prompt 4
My React codebase has deprecated API calls that the codemod cannot safely convert. Help me identify which components were skipped and write manual fixes for them.

Frequently asked questions

What is react-codemod?

A collection of scripts that automatically rewrite old React code to use modern patterns, like converting React.createClass to ES6 classes or updating API calls, so you don't have to update hundreds of files by hand.

What language is react-codemod written in?

Mainly JavaScript. The stack also includes JavaScript, React, Babel.

Is react-codemod actively maintained?

Dormant — no commits in 2+ years (last push 2017-04-14).

What license does react-codemod use?

No license information is provided in the explanation, so the licensing terms are unknown.

How hard is react-codemod to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is react-codemod for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.