Why does prefetching not work for <Link> component in Next.js?

Viewed 1183

I read many blogs everyone mentions that Next.js prefetches the Link but it was not working for me.

Here is my chrome network tab: enter image description here

that is my code that I tried:

import  Link from 'next/link' 

export default function Home() {
    return (
        <div >
          <Link href="/home">
              <a>Home</a>
          </Link>
          <Link href="/About/about">
              <a>About</a>
          </Link>
        </div>
    )
}
1 Answers

Next.js doesn't prefetch pages in development mode, prefetch is a production-only feature.

Try running your app in production mode instead.

npm run build && npm run start
Related