Use case
Framework
Owner
React/Create Element To Jsx
This codemod transforms React.createElement calls into JSX syntax, making your code more readable and maintainable.
React/Update React Imports
This codemod transforms React imports to use named imports instead of default or namespace imports. This helps reduce bundle size by allowing better tree-shaking of unused React exports.
With React Integration
This codemod transforms the usage of
withReact(createEditor())
into auseMemo
-based structure, which wraps the editor creation and introduces an inline-checking function (isInline
) for the editor instance. This transformation optimizes the creation of the editor object by memoizing it.Custom Renderers
This codemod updates the
renderElement
function to include TypeScript typings and adds a default case for rendering unsupported element types.Refactor Native Module Calls
This codemod updates your React Native code to use the New Architecture's synchronous native module calls, replacing callback-based patterns for improved performance and simplicity.
Remix/2/React Router/Upgrade
This codemod automates most of the manual steps outlined in the Remix to React Router upgrade guide.
React 17 Default Props To Params
Example
This codemod turns X into Y. It also does Z. Note: this is a contrived example. Please modify it.
React Router/6/UseHistory To UseNavigate
This codemod migrates
useHistory
touseNavigate
in React Router codebases. It replacesuseHistory
imports and updates all instances ofhistory.push
,history.replace
,go
,goBack
, andgoForward
to align with theuseNavigate
API.React Router/6/Switch To Routes
This codemod updates
Switch
components toRoutes
in React Router, in line with React Router v6 and newer. It also adjusts the imports, replacingSwitch
withRoutes
inreact-router-dom
import statements.React Router/6/Migrate StaticRouter Import
This codemod updates imports of
StaticRouter
to use thereact-router-dom/server
package instead ofreact-router-dom
, in line with updated React Router requirements.React Router/6/Seperate Link State Prop
This codemod simplifies the
Link
component by transforming itsto
prop from an object with apathname
to a string. It removes the unnecessary object wrapper around thepathname
, maintaining thestate
prop as is.React Router/6/Replace UseRouteMatchWithUseMatch
This codemod updates
useRouteMatch
calls to the neweruseMatch
function inreact-router-dom
. It also adjusts any arguments passed touseRouteMatch
, changingstrict
toend
andsensitive
tocaseSensitive
. Additionally, it ensures that imports are updated to reflect the removal ofuseRouteMatch
.React Router/6/Reorder Matchpath Args
This codemod reorders the arguments in the
matchPath
function calls. It switches the position of the string path and the second callback argument, improving consistency and readability.React Router/6/Remove ActiveStyleprops
This codemod updates
NavLink
components that use separatestyle
andactiveStyle
props to the modernisActive
function inreact-router-dom
. It simplifies the logic by combining the two props into a singlestyle
prop with conditional styling.React Router/6/Update Relative Links
This codemod modernizes
Route
andLink
components in React Router by:- Removing the deprecated
exact
prop fromRoute
. - Updating
Route
to use theelement
prop. - Rewriting dynamic
Link
andRoute
paths that use template literals like${match.url}
and${match.path}
.
- Removing the deprecated
React Router/5.1/Redirect To Navigate
This codemod updates deprecated
Redirect
components fromreact-router-dom
to the modernNavigate
API. It also updates the imports by replacingRedirect
withNavigate
.React Router/6/React Router Config To Use Routes
This codemod helps update code that uses
react-router-config
to the modernuseRoutes
API fromreact-router-dom
. It removesrenderRoutes
from imports and replaces it withuseRoutes
. Manual adjustments might be required after running the codemod, especially if other customizations exist in your routing logic.React Router/6/Navlink Exact To End
This codemod replaces the deprecated
exact
prop inNavLink
with the modernend
prop. React Router v6 and beyond useend
to indicate that the path should match exactly, making this a necessary update for compatibility with newer versions.React Router/5.1/Component Render To Children
This codemod transforms
Route
components usingrender
andcomponent
props into JSX with nested children.ChakraUI/V3/Update Chakra Provider
- Updates the ChakraProvider import from @chakra-ui/react
- Renames the theme prop to value to match the new system-based theming approach