M

react-router/6/replace-useRouteMatchWithUseMatch

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

This codemod updates useRouteMatch calls to the newer useMatch function in react-router-dom. It also adjusts any arguments passed to useRouteMatch, changing strict to end and sensitive to caseSensitive. Additionally, it ensures that imports are updated to reflect the removal of useRouteMatch.

Before

tsx

After

tsx

This codemod streamlines the use of route matching in your application, aligning with the latest React Router practices while ensuring existing functionality is preserved. It also removes any obsolete references to useRouteMatch in imports.

Ready to contribute?

Build your own codemod and share it with the community.