I was very surprised that a simple Link component is not working in Next.js when you want to use an external URL and HTML Button tag inside it.
Below you can see how I tried to solve the problem:
Approach number 1:
<Link href="https://stackoverflow.com/">
<button>StackOverflow</button>
</Link>
Approach number 2 (link without protocol):
<Link href="//stackoverflow.com/">
<button>StackOverflow</button>
</Link>
Approach number 3 (link without protocol and with Link attribute prefetch set to false or even true):
<Link href="//stackoverflow.com/" prefetch={false}>
<button>StackOverflow</button>
</Link>
IMPORTANT NOTE
Of course, mentioned case it's working when the URL is internal, like that:
<Link href="/stackoverflow">
<button>StackOverflow</button>
</Link>
or when I will change HTML button tag into HTML A tag, like that:
<Link href="//stackoverflow.com/">
<a>StackOverflow</a>
</Link>
In my case, I want to use the HTML button tag or any other UI component inside the Next.js Link component.