Skip to content

docs: add React Router v6 to v7 migration guide#2167

Open
Ankit-raj-11 wants to merge 1 commit intocodemod:mainfrom
Ankit-raj-11:feat/react-router-v6-to-v7-migration-guide
Open

docs: add React Router v6 to v7 migration guide#2167
Ankit-raj-11 wants to merge 1 commit intocodemod:mainfrom
Ankit-raj-11:feat/react-router-v6-to-v7-migration-guide

Conversation

@Ankit-raj-11
Copy link
Copy Markdown

Add a comprehensive migration guide for React Router v6 to v7 upgrade.

This guide documents the community-built codemod (react-router-v6-to-v7) that automates the migration with zero false positives using AST-based transforms via ast-grep.

The codemod handles 4 key transforms:

  • Import rewriting: react-router-dom → react-router
  • Future flag injection: Smart-merges all 6 mandatory v7 flags
  • API modernization: Unwraps deprecated json()/defer() calls
  • Package migration: Updates package.json dependencies

Validated on real-world repos (react-admin, react-petstore) with 0 false positives across all validations.

Registry: https://app.codemod.com/registry/react-router-v6-to-v7
Source: https://github.com/Ankit-raj-11/react-router-v6-to-v7
Case Study: https://dev.to/ankit_raj_16a4c518f4c1689/automating-react-router-v6-to-v7-migration-with-ast-codemods-2888

📚 Description

🔗 Linked Issue

🧪 Test Plan

📄 Documentation to Update

Add a comprehensive migration guide for React Router v6 to v7 upgrade.

This guide documents the community-built codemod (react-router-v6-to-v7)
that automates the migration with zero false positives using AST-based
transforms via ast-grep.

The codemod handles 4 key transforms:
- Import rewriting: react-router-dom → react-router
- Future flag injection: Smart-merges all 6 mandatory v7 flags
- API modernization: Unwraps deprecated json()/defer() calls
- Package migration: Updates package.json dependencies

Validated on real-world repos (react-admin, react-petstore) with 0 false
positives across all validations.

Registry: https://app.codemod.com/registry/react-router-v6-to-v7
Source: https://github.com/Ankit-raj-11/react-router-v6-to-v7
Case Study: https://dev.to/ankit_raj_16a4c518f4c1689/automating-react-router-v6-to-v7-migration-with-ast-codemods-2888
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants