M

react-router/6/Migrate-StaticRouter-Import

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 imports of StaticRouter to use the react-router-dom/server package instead of react-router-dom, in line with updated React Router requirements.

Before

tsx

After

tsx

This codemod ensures compatibility with the latest React Router version by splitting StaticRouter imports into the correct package. Other imports from react-router-dom remain unaffected.

Ready to contribute?

Build your own codemod and share it with the community.