
useRouterWithEvent()
Open SourceDescription:
Since the release of Next.js 13, which introduced the App directory, a new useRouter hook from next/navigation was provided for handling routing. However, this new useRouter hook lacks the events that were available in the previous useRouter hook from next/router that is used in the pages directory, which is crucial for certain use cases. Consequently, this package was developed to add those events to the new useRouter hook, ensuring similar behavior and API to the old useRouter hook.
This package provides a hook called useRouterWithEvents, which is compatible with both Next.js 13 and Next.js 14.