When using the inbuilt NuxtLink
component to navigate between pages, use the 'to' prop instead of the 'href' attribute that is generally used with the HTML <a>
tag.
Internal links can then be routed to using optimizations such as pre-fetching.
Using 'href' with NuxtLink can lead to unintended bugs and minor performance issues.
<template>
<NuxtLink href="/home">Home</NuxtLink>
<NuxtLink href="/about" to="/about">About</NuxtLink>
<NuxtLink href="/about" :to="`/product/${id}`">Product</NuxtLink>
</template>
<template>
<NuxtLink to="/home">Home</NuxtLink>
<NuxtLink to="/about">About</NuxtLink>
<NuxtLink :to="`/product/${id}`">Product</NuxtLink>
</template>