Next.js Discord

Discord Forum

useRouter hook autoimport issue

Unanswered
rahulrbbisht posted this in #help-forum
Open in Discord
Avatar
rahulrbbishtOP
In Docs the use Router hook is imported from 'next/navigation' while when i am calling the useRouter hook directly in vs code as autoImport it is imported from 'next/router' so it is problem of vs code editor or there is issue in next js router itself

6 Replies

Avatar
Madeiran sardinella
if you're using the app directory in Nextjs 13, it's next/navigation, but it's next/router for the pages directory
Avatar
joulev & fuma pray for Schneider
in my case vscode suggests both next/router and next/navigation, next/router is the first suggestion and next/navigation is the second suggestion, and i just select the second one
this is neither a nextjs bug nor a vscode bug
you just have to select the right one
not a nextjs bug because the two hooks are working normally
not a vscode bug because it does suggest both