I created a not-found.tsx
component in my app directory in nextjs 13.4 which works fine when I enter wrong route as seen below:
import Link from 'next/link'
function NotFound() {
return (
<section>
404, page not found
<br/>
<Link href="/">Back to HomePage</Link>
</section>
)
}
export default NotFound
But when I click the link to go back to the homepage, I still get the 404 page not found page.
I tried using the useRouter
to navigate away but got the same problem. I notice the issue is as a result of not-found being in the app directory with the homepage
So how do I navigate from the not found page to the home page?
this was a bug in nextjs 13.4 and it has been fixed, just install the latest version of next npm install next@latest react@latest react-dom@latest. and everything should work fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With