Use case
Framework
Owner
Liz/React Router/Headers Export
This is a codemod that automatically adds the required
headersexport to pages usingauthenticate.admin().React Router/4/Move Hoc To Global Scope
Moves HOC calls to the global scope
Codemod verified
Regularly tested and maintained by our engineers and codemod expert community
Remix/2/React Router/Upgrade
This codemod automates most of the manual steps outlined in the Remix to React Router upgrade guide.
React Router/6/UseHistory To UseNavigate
This codemod migrates
useHistorytouseNavigatein React Router codebases. It replacesuseHistoryimports and updates all instances ofhistory.push,history.replace,go,goBack, andgoForwardto align with theuseNavigateAPI.React Router/6/Switch To Routes
This codemod updates
Switchcomponents toRoutesin React Router, in line with React Router v6 and newer. It also adjusts the imports, replacingSwitchwithRoutesinreact-router-domimport statements.React Router/6/Migrate StaticRouter Import
This codemod updates imports of
StaticRouterto use thereact-router-dom/serverpackage instead ofreact-router-dom, in line with updated React Router requirements.React Router/6/Seperate Link State Prop
This codemod simplifies the
Linkcomponent by transforming itstoprop from an object with apathnameto a string. It removes the unnecessary object wrapper around thepathname, maintaining thestateprop as is.React Router/6/Replace UseRouteMatchWithUseMatch
This codemod updates
useRouteMatchcalls to the neweruseMatchfunction inreact-router-dom. It also adjusts any arguments passed touseRouteMatch, changingstricttoendandsensitivetocaseSensitive. Additionally, it ensures that imports are updated to reflect the removal ofuseRouteMatch.React Router/6/Update Relative Links
This codemod modernizes
RouteandLinkcomponents in React Router by:- Removing the deprecated
exactprop fromRoute. - Updating
Routeto use theelementprop. - Rewriting dynamic
LinkandRoutepaths that use template literals like${match.url}and${match.path}.
- Removing the deprecated
React Router/6/Navlink Exact To End
This codemod replaces the deprecated
exactprop inNavLinkwith the modernendprop. React Router v6 and beyond useendto indicate that the path should match exactly, making this a necessary update for compatibility with newer versions.React Router/7/Migration Recipe
This codemods designed to facilitate the migration of your project from React Router to version 7. Each codemod targets specific changes and improvements introduced in React Router v7, ensuring a smoother transition.
React Router/7/Add V7 RelativeSplatPath Flag
This transformation adds the necessary configuration to enable v7 features, specifically the v7_relativeSplatPath flag. It affects both components and createBrowserRouter configurations.