lifecycle/migrate-from-react-router
Installation
SKILL.md
Migrate from React Router v7 to TanStack Router
This is a step-by-step migration checklist. Each check covers one conversion task. Complete them in order.
CRITICAL: If your UI is blank after migration, open the console. Errors like "cannot use useNavigate outside of context" mean React Router imports remain alongside TanStack Router imports. Uninstall
react-router(andreact-router-domif present) to surface them as TypeScript errors.CRITICAL: TanStack Router uses
to+paramsfor navigation, NOT template literal paths. Never interpolate params into thetostring.NOTE: React Router v7 recommends importing from
react-router(notreact-router-dom). Thereact-router-dompackage still exists but just re-exports fromreact-router. Check for imports from both.
Pre-Migration
- Create a migration branch
git checkout -b migrate-to-tanstack-router
- Install TanStack Router alongside React Router temporarily