NextJs router error in app dir
Can anyone help me why I am getting this error ,I have used 'use client' directive in this component , but still its throwing this
![](https://cdn.answeroverflow.com/1108330625267675186/Screenshot_2023-05-17_at_2.44.06_PM.png)
2 Replies
Make sure you're importing the correct useRouter from 'next/navigation' instead of 'next/router' if you are using the app dir
https://nextjs.org/docs/app/api-reference/functions/use-router
Functions: useRouter
API reference for the useRouter hook.
Thank you , I haven't checked this properly, will try using this