React Router/6/Reorder Matchpath Args

/icons/calendar.svg

Last update

Nov 4, 2024

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.

Before

matchPath("/home", { exact: true });

After

matchPath({ exact: true }, "/home");

This change ensures that the string path is now the second argument, following the newer convention for using matchPath.

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now