M

react-router/6/react-router-config-to-use-routes

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 helps update code that uses react-router-config to the modern useRoutes API from react-router-dom. It removes renderRoutes from imports and replaces it with useRoutes. Manual adjustments might be required after running the codemod, especially if other customizations exist in your routing logic.

Before

tsx

After

tsx

This demonstrates how the routing logic is updated to use useRoutes instead of renderRoutes, and routes are adapted from component to element.

Ready to contribute?

Build your own codemod and share it with the community.