Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Refactor useRouter Usage for App Router Migration #2792

Open
3 tasks
ZenoWang1999 opened this issue Jan 26, 2025 · 0 comments
Open
3 tasks

🐛 Refactor useRouter Usage for App Router Migration #2792

ZenoWang1999 opened this issue Jan 26, 2025 · 0 comments

Comments

@ZenoWang1999
Copy link
Contributor

🐛 Describe the Bug

Many components are utilizing useRouter, but its usage in the app router differs significantly from the page router. This mismatch results in runtime errors.
See https://nextjs.org/docs/14/app/building-your-application/upgrading/app-router-migration#step-5-migrating-routing-hooks

🧑‍💻 Reproduction Steps

  1. Use a component with useRouter that was implemented for the page router.
  2. Attempt to run the app with the app router.
  3. Observe runtime errors caused by incorrect useRouter usage.

🎯 Expected Behaviour

Components using useRouter should be updated for compatibility with the app router.

💼 Tasks

  • Audit the codebase to identify components using useRouter.
  • Update the implementation of useRouter where needed to meet app router requirements.
  • Test updated components to ensure compatibility.

✅ Acceptance Criteria

All components using useRouter function without errors in the app router.

➕ More Information

Refer to the Next.js documentation for app router migration:
https://nextjs.org/docs/14/app/building-your-application/upgrading/app-router-migration#step-5-migrating-routing-hooks

@ZenoWang1999 ZenoWang1999 changed the title 🐛 Refactor useRouter Usage for App Router Migration 🐛 Refactor useRouter Usage for App Router Migration Jan 26, 2025
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

No branches or pull requests

1 participant