Skip to main content
InterviewHubPRO
Section Overview
Q6

Question 6 of 50

Part 1: Nuxt 3 Fundamentals (Junior / Entry-Level)

12%
Nuxt & Universal SSR (50 Qs)•Part 1: Nuxt 3 Fundamentals (Junior / Entry-Level)

What is the `<NuxtLink>` component and how does it optimize navigation?

junior LevelCode ExampleComponentsRoutingVue & Nuxt

In Simple Words: <NuxtLink> replaces traditional <a> tags for internal and external links. It provides seamless client-side single-page transitions and automated background prefetching.

Optimization Features:

  1. Smart Prefetching: When a <NuxtLink> enters the user's viewport, Nuxt automatically prefetches the payload and JavaScript chunks for that target route in the background using requestIdleCallback.
  2. Intelligent Protocol Detection: If the href starts with https:// or mailto:, it automatically renders as a standard external link (rel="noopener noreferrer").
  3. Active Class Matching: Automatically applies router-link-active and router-link-exact-active CSS classes.
vue
<template>
  <!-- Automatically prefetched when scrolled into view -->
  <NuxtLink to="/dashboard" prefetch class="nav-btn">
    Dashboard
  </NuxtLink>

  <!-- External link automatically handled -->
  <NuxtLink to="https://github.com" target="_blank">
    GitHub
  </NuxtLink>
</template>