A codemod to migrate React Native imports from the old 'react-native' style to the new 'react' and 'react-native' split required in RN25.
codemod-RN24-to-RN25 is a codemod (code modification script) that automates the migration of import statements in React Native projects from version 24 to version 25. It specifically addresses the breaking change in RN25 where React core exports like `React`, `Component`, and `PropTypes` must be imported from the 'react' package instead of 'react-native'. This tool saves developers hours of manual file editing by programmatically updating imports across an entire codebase.
React Native developers or teams upgrading their projects from React Native 24 to 25, especially those with large codebases where manual import updates would be error-prone and time-consuming.
Developers choose this codemod because it provides a reliable, automated solution for a mandatory but tedious upgrade task, reducing human error and saving significant development time compared to manual refactoring. It integrates seamlessly with the standard jscodeshift workflow.
A simple codemod to handle the new import style on RN25
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automatically transforms React core imports from 'react-native' to 'react', saving hours of manual refactoring as demonstrated in the clear before-and-after example in the README.
Built as a transform for the popular jscodeshift toolkit, ensuring reliable, scriptable code modifications that can be run across large codebases with a single command.
Supports recast printer options via the command line, allowing developers to enforce style preferences like double quotes, as detailed in the README's example.
The README includes explicit before-and-after code snippets that illustrate the transformation effect, making it easy to understand and verify changes.
Only addresses the migration from RN24 to RN25; it becomes obsolete for other version upgrades or projects not on those versions, limiting long-term use.
Requires global installation of jscodeshift, adding setup overhead and potential compatibility issues for teams not already familiar with the toolkit.
The README does not mention how to handle failures or rollback changes, which could be risky if the codemod encounters complex or malformed code.