# Route prefetching

Feature 5 of 14, in the group "First-paint levers". Labels across 23 meta-frameworks: 19 1st-party, 1 Experimental, 0 Third-party, 3 Manual.

## What it is and why it matters

Prefetching loads a route's code and data before the click, on hover, focus, or when the link enters the viewport. In principle it helps the *next* navigation rather than the first paint, so it matters for how fast the app feels once someone starts clicking.

## Gotchas

- Prefetching spends bandwidth on routes the user may never visit; `intent` (hover/focus) is the conservative setting.

## Labels

| Framework | Label | Points |
| --- | --- | --- |
| [Next](https://framework-compare.vercel.app/frameworks/next.md) | 1st-party | 2 |
| [Nuxt](https://framework-compare.vercel.app/frameworks/nuxt.md) | Experimental | 1 |
| [SvelteKit](https://framework-compare.vercel.app/frameworks/sveltekit.md) | 1st-party | 2 |
| [SolidStart](https://framework-compare.vercel.app/frameworks/solidstart.md) | 1st-party | 2 |
| [TanStack Start (React)](https://framework-compare.vercel.app/frameworks/tanstack-start-react.md) | 1st-party | 2 |
| [TanStack Start (Solid)](https://framework-compare.vercel.app/frameworks/tanstack-start-solid.md) | 1st-party | 2 |
| [Pracht](https://framework-compare.vercel.app/frameworks/pracht.md) | 1st-party | 2 |
| [Waku](https://framework-compare.vercel.app/frameworks/waku.md) | 1st-party | 2 |
| [Ember](https://framework-compare.vercel.app/frameworks/ember.md) | Manual | 0 |
| [Astro](https://framework-compare.vercel.app/frameworks/astro.md) | 1st-party | 2 |
| [React Router](https://framework-compare.vercel.app/frameworks/react-router.md) | 1st-party | 2 |
| [Qwik City](https://framework-compare.vercel.app/frameworks/qwik-city.md) | 1st-party | 2 |
| [Angular (SSR)](https://framework-compare.vercel.app/frameworks/angular.md) | 1st-party | 2 |
| [Marko](https://framework-compare.vercel.app/frameworks/marko.md) | Manual | 0 |
| [Fresh](https://framework-compare.vercel.app/frameworks/fresh.md) | Manual | 0 |
| [Analog](https://framework-compare.vercel.app/frameworks/analog.md) | 1st-party | 2 |
| [Vike](https://framework-compare.vercel.app/frameworks/vike.md) | 1st-party | 2 |
| [RedwoodSDK](https://framework-compare.vercel.app/frameworks/redwoodsdk.md) | 1st-party | 2 |
| [Remix 3](https://framework-compare.vercel.app/frameworks/remix.md) | 1st-party | 2 |
| [Void (React)](https://framework-compare.vercel.app/frameworks/void-react.md) | 1st-party | 2 |
| [Void (Vue)](https://framework-compare.vercel.app/frameworks/void-vue.md) | 1st-party | 2 |
| [Void (Svelte)](https://framework-compare.vercel.app/frameworks/void-svelte.md) | 1st-party | 2 |
| [Void (Solid)](https://framework-compare.vercel.app/frameworks/void-solid.md) | 1st-party | 2 |

## How to enable it in each framework

### Next

Label: **1st-party** (2 of 2 points).

Set [`partialPrefetching`](https://nextjs.org/docs/app/api-reference/config/next-config-js/partialPrefetching) (needs `cacheComponents`; 16.3+), pass `prefetch={true}` on high-value links ([`<Link>`](https://nextjs.org/docs/app/api-reference/components/link)), and optionally add the `FastLink` mouse-down navigation.

```ts
const nextConfig: NextConfig = {
  cacheComponents: true,
  partialPrefetching: true,
};
```

```tsx
<FastLink href={href} prefetch={true}>
```

*Adapted from this repo's `next-books/next.config.ts` (other options omitted) and `features/book/components/book-pagination.tsx` (`href` expression simplified; other props omitted); `FastLink` is this repo's wrapper around `Link`.*

### Nuxt

Label: **Experimental** (1 of 2 points).

Use [`<NuxtLink>`](https://nuxt.com/docs/4.x/api/components/nuxt-link) `prefetch-on="visibility" | "interaction"`, `_payload.json` payload prefetch, and [`experimental.prefetchPreloadTags`](https://nuxt.com/docs/4.x/guide/going-further/experimental-features) (experimental, off by default).

```vue
<FastLink :prefetch-on="eagerPrefetch ? 'visibility' : 'interaction'" :to="href">
```

```ts
experimental: {
  prefetchPreloadTags: true,
},
```

*From this repo's `nuxt-books/app/components/BookCard.vue` (`FastLink` is this repo's wrapper around `NuxtLink`; class omitted) and `nuxt.config.ts` (`optimized` branch; `early404` omitted).*

### SvelteKit

Label: **1st-party** (2 of 2 points).

Set [`data-sveltekit-preload-data="hover"`](https://svelte.dev/docs/kit/link-options). This repo's `FastLink` wrapper maps a `preload` prop to that attribute per link (`'hover'` or `'off'`); the pagination and sidebar links pass it explicitly and book cards pass `preload={eagerPrefetch}`. The starter template already sets the attribute on `<body>`, and JS/CSS are preloaded automatically ([performance](https://svelte.dev/docs/kit/performance)).

```html
<body data-sveltekit-preload-data="hover">
```

*From this repo's `svelte-books/src/app.html` (`optimized` branch; class attribute omitted).*

Gotchas:

- Needs the `data-sveltekit-preload-data` attribute somewhere (the starter template adds it).

### SolidStart

Label: **1st-party** (2 of 2 points).

Solid Router v1 and the `2.0.0-next.21` prerelease this port pins [preload](https://v1.solidjs.com/solid-router/advanced-concepts/preloading) on hover (~20ms) and focus by default. In Solid Router 2.0 stable (npm `latest` 2.0.1) link preloading is [opt-in](https://docs.solidjs.com/routing/solid-router/data#preloading-from-links): `createRouter({ routes, preloadLinks: intentPreload() })`, with `tapPreload`, `viewportPreload` and `eagerPreload` as other strategies. [`usePreloadRoute`](https://docs.solidjs.com/reference/solid-router/navigation#usepreloadroute) is the manual API, and this port's `FastLink` calls it on hover and focus (and eagerly when its `prefetch` prop is set), and starts the navigation on mouse-down.

```tsx
import { useNavigate, usePreloadRoute } from "@solidjs/router";
```

*From this repo's `solid-books/src/components/ui/fast-link.tsx` (`optimized` branch).*

### TanStack Start (React)

Label: **1st-party** (2 of 2 points).

Router [preloading](https://tanstack.com/router/latest/docs/framework/react/guide/preloading) is off by default; `defaultPreload: 'intent' | 'viewport' | 'render'` turns it on. This port sets `'intent'` and wraps links with `FastLink`.

```ts
const router = createTanStackRouter({
  routeTree,
  defaultPreload: 'intent',
})
```

*From this repo's `tanstack-books/src/router.tsx` (`optimized` branch; other options omitted).*

Gotchas:

- Preloading is off until you set `defaultPreload`.
- `defaultPreloadStaleTime: 0` makes data loaded on hover stale at once, so the click loads it again. Use 0 only when an outside cache such as TanStack Query handles reuse.

### TanStack Start (Solid)

Label: **1st-party** (2 of 2 points).

The same router [preloading](https://tanstack.com/router/latest/docs/framework/solid/guide/preloading) applies. This port sets `defaultPreload: 'intent'` in `tanstack-solid-books/src/router.tsx` (`optimized` branch) with `@tanstack/solid-router`, but it does not use the router's `<Link>`: its `FastLink` (`src/components/ui/fast-link.tsx`) is a plain `<a>` that calls `router.preloadRoute()` on hover and focus (and on render when `prefetch` is set), so preloading is wired by hand through the manual API rather than by the `defaultPreload` setting.

Example of building it yourself:

`defaultPreload: 'intent'` makes every router `<Link>` preload its route on hover or focus. The port's `FastLink` is a plain `<a>`, so it calls `router.preloadRoute()` itself on the same events.

```tsx
// src/router.tsx
const router = createTanStackRouter({
  routeTree,
  defaultPreload: 'intent',
  defaultPreloadStaleTime: 0,
})
```

```tsx
// src/components/ui/fast-link.tsx
const router = useRouter()

function warm() {
  const url = new URL(props.href, 'http://tanstack-solid-books.local')
  const id = url.pathname === '/' ? undefined : url.pathname.slice(1)
  const search = Object.fromEntries(url.searchParams)
  void router
    .preloadRoute(id ? { to: '/$id', params: { id }, search } : { to: '/', search })
    .catch(() => {})
}

return <a href={props.href} onFocus={warm} onMouseEnter={warm}>{props.children}</a>
```

Source: [TanStack Router: Preloading](https://tanstack.com/router/latest/docs/framework/solid/guide/preloading)

Gotchas:

- Preloading is off until you set `defaultPreload`.

### Pracht

Label: **1st-party** (2 of 2 points).

Use the [`prefetch`](https://pracht.resynapse.dev/docs/prefetching) route option or `<Link>` prop; the default is `intent` (`hover` is an alias), with `viewport`, `none`, and link-only `render` also available.

```tsx
<Link route="book" prefetch={eagerPrefetch ? 'viewport' : 'intent'} />
```

*Adapted from this repo's `pracht-books/src/features/book/components/book-card.tsx` (`optimized` branch; other props omitted).*

### Waku

Label: **1st-party** (2 of 2 points).

[`router.prefetch()`](https://waku.gg/#navigation) is the manual API, documented under `useRouter` with no experimental marker. The [navigation-prefetching guide](https://waku.gg/guides/navigation-prefetching) is tagged Experimental and says its prefetch and instant-navigation props are experimental: the `Link` helpers are `unstable_prefetchOnEnter` / `unstable_prefetchOnView`, and `Link` prefetch is off unless a prop is set. This port uses the props on `FastLink` and `HoverPrefetchLink`.

```tsx
<Link
  to={hrefToTarget(href)}
  unstable_prefetchOnEnter={prefetchOnEnter}
  unstable_prefetchOnView={prefetchOnView}
/>
```

*From this repo's `waku-books/src/components/ui/fast-link.tsx` (`optimized` branch; other props omitted).*

Gotchas:

- Preloading is off until you pass a prop to the link.

### Ember

Label: **Manual** (0 of 2 points).

Nothing to enable, and no first-party prefetch is documented: the [linking-between-routes guide](https://guides.emberjs.com/release/routing/linking-between-routes/) describes `<LinkTo>` without prefetching; you wire it yourself with a custom modifier or service.

Example of building it yourself:

Write an `ember-modifier` that starts the book request on hover or focus and caches the promise. The route's `model` hook then reads the same cached promise. `<LinkTo>` passes the modifier through to its `<a>`.

```gjs
// app/lib/book/load-catalog.js
const bookCache = new Map();
export function prefetchBook(id, searchParams) {
  const key = `${id}?${stringifySearchParams(searchParams)}`;
  if (!bookCache.has(key)) bookCache.set(key, loadBook(id, searchParams));
  return bookCache.get(key);
}

// app/modifiers/prefetch-book.js
import { modifier } from 'ember-modifier';
import { prefetchBook } from '../lib/book/load-catalog';

export default modifier((element, [id, searchParams]) => {
  const warm = () => prefetchBook(id, searchParams);
  element.addEventListener('pointerenter', warm, { once: true });
  element.addEventListener('focus', warm, { once: true });
  return () => {
    element.removeEventListener('pointerenter', warm);
    element.removeEventListener('focus', warm);
  };
});

// app/routes/book.js: model(params) { return prefetchBook(params.id, parseSearchParams(params)); }
// app/components/book/book-card.gjs
<LinkTo @route="book" @model={{this.bookId}} @query={{this.query}}
        {{prefetchBook this.bookId @searchParams}}>
  {{! … }}
</LinkTo>
```

### Astro

Label: **1st-party** (2 of 2 points).

`prefetch: true` adds the script; links opt in via `data-astro-prefetch` or `prefetch.prefetchAll: true`. Strategies `hover` (default), `tap`, `viewport`, `load`; falls back to `tap` on data saver. `<ClientRouter />` pages prefetch by default. `eagerness` and Speculation Rules need experimental `clientPrerender`. ([prefetch](https://docs.astro.build/en/guides/prefetch/))

Example of building it yourself:

`prefetch: true` turns on the prefetch script. Links opt in with `data-astro-prefetch` and a strategy, or `prefetchAll` covers every link.

```js
// astro.config.mjs
import { defineConfig } from 'astro/config';

export default defineConfig({
  prefetch: {
    prefetchAll: true,
    defaultStrategy: 'viewport', // 'hover' (default) | 'tap' | 'viewport' | 'load'
  },
});
```

```astro
<!-- src/components/Nav.astro -->
<a href="/books" data-astro-prefetch="tap">Books</a>
<a href="/account" data-astro-prefetch="false">Account</a>
```

Source: [Astro: Prefetch](https://docs.astro.build/en/guides/prefetch/)

### React Router

Label: **1st-party** (2 of 2 points).

`<Link prefetch="none|intent|render|viewport">`, default `none`, uses `<link rel="prefetch">`. Lazy route discovery is on by default and batch-discovers rendered links; `discover="none"` opts out. ([Link](https://reactrouter.com/api/components/Link), [lazy-route-discovery](https://reactrouter.com/explanation/lazy-route-discovery), [react-router.config.ts](https://reactrouter.com/api/framework-conventions/react-router.config.ts))

Example of building it yourself:

Set `prefetch` on `<Link>`. `"intent"` loads the route module and data on hover or focus, `"viewport"` when the link scrolls into view, and `"render"` as soon as it renders. The port wraps `<Link>` in its own `FastLink`.

```tsx
// app/components/ui/fast-link.tsx
import { Link } from 'react-router'
// …
export function FastLink({ href, prefetch = 'intent', ...rest }: Props) {
  return (
    <Link
      prefetch={prefetch === false ? 'none' : prefetch === true ? 'intent' : prefetch}
      to={href}
      {...rest}
    />
  )
}
```

Source: [React Router: Link](https://reactrouter.com/api/components/Link)

### Qwik City

Label: **1st-party** (2 of 2 points).

`<Link>` prefetches on hover by default (`prefetch={false}` disables). The preloader adds `<link rel="modulepreload">` for handlers and dependencies using a bundle graph; works only in preview/production builds. ([routing](https://qwik.dev/docs/routing/), [modules-prefetching](https://qwik.dev/docs/advanced/modules-prefetching/), [speculative-module-fetching](https://qwik.dev/docs/advanced/speculative-module-fetching/))

Example of building it yourself:

`<Link>` starts prefetching the next page when the user hovers it. Set `prefetch={false}` to turn that off for one link.

```tsx
// src/components/nav/nav.tsx
import { component$ } from '@builder.io/qwik'
import { Link } from '@builder.io/qwik-city'

export const Nav = component$(() => (
  <nav>
    <Link href="/books">Books</Link>
    <Link href="/account" prefetch={false}>Account</Link>
  </nav>
))
```

Source: [Qwik: Routing](https://qwik.dev/docs/routing/)

### Angular (SSR)

Label: **1st-party** (2 of 2 points).

Opt-in `withPreloading(PreloadAllModules)` preloads lazy route chunks; `@defer` has `prefetch on idle/viewport/hover`. No link hover/viewport prefetch documented. The default strategy is `NoPreloading`, so nothing is preloaded until `withPreloading(...)` is added. ([NoPreloading](https://angular.dev/api/router/NoPreloading), [PreloadAllModules](https://angular.dev/api/router/PreloadAllModules), [defer](https://angular.dev/guide/templates/defer))

Example of building it yourself:

The router preloads nothing by default (`NoPreloading`). Add `withPreloading(PreloadAllModules)` to fetch every lazy route chunk after the app starts. `@defer` blocks take their own `prefetch` trigger.

```ts
// src/app/app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideRouter, withPreloading, PreloadAllModules } from '@angular/router';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
  providers: [provideRouter(routes, withPreloading(PreloadAllModules))],
};
```

```html
<!-- any template: load the chunk on interaction, prefetch it when the browser is idle -->
@defer (on interaction; prefetch on idle) {
  <app-book-reviews />
} @placeholder {
  <button>Show reviews</button>
}
```

Source: [Angular: Customizing route behavior](https://angular.dev/guide/routing/customizing-route-behavior)

### Marko

Label: **Manual** (0 of 2 points).

No prefetch/preload API in the Marko Run docs or full reference. Lazy `load` triggers (`visible`, `idle`, `media`, events) defer a tag's JS only; that is not route prefetch. ([lazy-loading](https://markojs.com/docs/reference/lazy-loading))

Example of building it yourself:

Marko Run navigates with full documents, so a Speculation Rules block in the layout handles it. Supporting browsers prefetch same-origin links on hover; the others ignore the block.

```marko
// src/routes/+layout.marko
<head>
  // …
  <html-script type="speculationrules">
    {
      "prefetch": [{
        "where": { "and": [
          { "href_matches": "/*" },
          { "not": { "selector_matches": "[rel~=nofollow]" } }
        ]},
        "eagerness": "moderate"
      }]
    }
  </html-script>
</head>
```

Source: [MDN: speculationrules](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/speculationrules)

### Fresh

Label: **Manual** (0 of 2 points).

No first-party prefetch documented; partials (`f-client-nav`, `f-partial`) fetch on click only. ([partials](https://usefresh.dev/docs/advanced/partials))

Example of building it yourself:

Add a Speculation Rules block to `_app.tsx`. Supporting browsers prefetch same-origin pages on hover, and other browsers ignore it. The prefetch only helps full-page navigations, so it does not speed up links that use Fresh partials (`f-client-nav`).

```tsx
// routes/_app.tsx
const speculationRules = JSON.stringify({
  prefetch: [{
    where: { and: [
      { href_matches: "/*" },
      { not: { selector_matches: "[rel~=nofollow]" } },
    ] },
    eagerness: "moderate",
  }],
});

// … inside <head>:
<script type="speculationrules" dangerouslySetInnerHTML={{ __html: speculationRules }} />
```

Source: [MDN: speculationrules](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script/type/speculationrules)

### Analog

Label: **1st-party** (2 of 2 points).

Angular Router preloading: pass `withPreloading(PreloadAllModules)` to `provideFileRouter(...)`, which accepts Angular router features, to preload lazy route chunks. The Analog docs show other router features there (`withComponentInputBinding`, `withNavigationErrorHandler`) and no preloading example. No link hover or viewport prefetch documented. ([routing](https://analogjs.org/docs/features/routing/overview), [PreloadAllModules](https://angular.dev/api/router/PreloadAllModules))

Example of building it yourself:

`provideFileRouter()` takes Angular router features. `withPreloading(PreloadAllModules)` loads every lazy page chunk after the app starts.

```ts
// src/app/app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideFileRouter } from '@analogjs/router';
import { PreloadAllModules, withComponentInputBinding, withPreloading } from '@angular/router';

export const appConfig: ApplicationConfig = {
  providers: [
    provideFileRouter(withComponentInputBinding(), withPreloading(PreloadAllModules)),
    // …
  ],
};
```

Source: [Analog: Routing](https://analogjs.org/docs/features/routing/overview), [Angular: PreloadAllModules](https://angular.dev/api/router/PreloadAllModules)

### Vike

Label: **1st-party** (2 of 2 points).

`prefetchStaticAssets: 'hover' | 'viewport' | false`, default `'hover'`, per page, with a per-link `data-prefetch-static-assets` override and a programmatic `prefetch('/url')`. Only static assets are prefetched; page data is not. ([prefetchStaticAssets](https://vike.dev/prefetchStaticAssets), [prefetch](https://vike.dev/prefetch))

Example of building it yourself:

`prefetchStaticAssets` sets when a link's page assets are prefetched. A link can override it with `data-prefetch-static-assets`, and `prefetch()` starts it from code.

```tsx
// pages/+config.ts
export default { prefetchStaticAssets: 'viewport' }

// components/BookLink.tsx
import { prefetch } from 'vike/client/router'

export function BookLink({ id }: { id: string }) {
  return (
    <a href={`/book/${id}`} data-prefetch-static-assets="hover" onFocus={() => prefetch(`/book/${id}`)}>
      Details
    </a>
  )
}
```

Source: [Vike: prefetchStaticAssets](https://vike.dev/prefetchStaticAssets) · [Vike: prefetch()](https://vike.dev/prefetch)

### RedwoodSDK

Label: **1st-party** (2 of 2 points).

With client-side navigation on, `<link rel="x-prefetch" href="/about" />` makes RedwoodSDK fetch that route in the background after each navigation and store the response in the browser Cache API. Needs the `onHydrated` callback from `initClientNavigation()`. No hover or viewport trigger documented. ([client-side-nav](https://docs.rwsdk.com/guides/frontend/client-side-nav))

Example of building it yourself:

Turn on client navigation and pass `onHydrated` to `initClient`. Then render `<link rel="x-prefetch">` for likely next routes. RedwoodSDK fetches each one after navigation and keeps it in the Cache API.

```tsx
// src/client.tsx
import { initClient, initClientNavigation } from "rwsdk/client";

const { handleResponse, onHydrated } = initClientNavigation();
initClient({ handleResponse, onHydrated });
```

```tsx
// src/app/pages/BlogListPage.tsx
import { link } from "@/shared/links";

export function BlogListPage({ posts }) {
  return posts.map((post) => {
    const href = link("/blog/:slug", { slug: post.slug });
    return (
      <article key={post.id}>
        <link rel="x-prefetch" href={href} />
        <a href={href}><h2>{post.title}</h2></a>
      </article>
    );
  });
}
```

Source: [RedwoodSDK: Client Side Navigation](https://docs.rwsdk.com/guides/frontend/client-side-nav)

### Remix 3

Label: **1st-party** (2 of 2 points).

`<a href="/products/shirt" data-rmx-prefetch="intent">` or `"viewport"` loads the destination before navigation; `prefetch()` from `remix/component` does it from code. ([component](https://docs.remix.run/api/component/#prefetching), [interactivity](https://docs.remix.run/interactivity/))

Example of building it yourself:

Add `data-rmx-prefetch` to a link to load the destination on hover or focus (`intent`) or when it scrolls into view (`viewport`). `prefetch()` does the same from code.

```tsx
// app/ui/book-link.tsx
import { prefetch } from "remix/component";
import type { Handle } from "remix/component";
import { routes } from "../routes.ts";

export function BookLink(handle: Handle<{ bookId: string; title: string }>) {
  return () => (
    <a href={routes.books.show.href({ bookId: handle.props.bookId })} data-rmx-prefetch="intent">
      {handle.props.title}
    </a>
  );
}

// elsewhere, from custom logic
prefetch(routes.books.show.href({ bookId: "dune" }));
```

Source: [Remix: Interactivity, prefetch links before navigation](https://docs.remix.run/interactivity/)

### Void (React)

Label: **1st-party** (2 of 2 points).

`<Link href="/dashboard" prefetch>` from `@void/react`, with strategies `'hover' | 'click' | 'mount' | 'visible'` (or an array), an app-wide `prefetch.defaultStrategy` on `voidReact()` (default `false`), `hoverDelay` (75 ms) and `cacheFor`, plus `router.prefetch()`. Prefetching runs the destination's loader, so page data is prefetched as well as code. Links skip it on data saver or 2G. ([overview](https://void.cloud/guide/pages-routing/overview), [pages adapters](https://void.cloud/reference/api/pages))

Example of building it yourself:

Add `prefetch` to `<Link>`. It loads the destination's code and runs its loader before the click. Strategies are `hover`, `click`, `mount` and `visible`, and `prefetch.defaultStrategy` on `voidReact()` turns it on for every link.

```tsx
// pages/index.tsx
import { Link } from '@void/react'

export function BookLink({ id, title }: { id: string; title: string }) {
  return <Link href={`/${id}`} prefetch="hover">{title}</Link>
}
```

Source: [Void: Prefetching](https://void.cloud/reference/api/pages#prefetching)

### Void (Vue)

Label: **1st-party** (2 of 2 points).

`<Link href="/dashboard" prefetch>` from `@void/vue`, with strategies `'hover' | 'click' | 'mount' | 'visible'` (or an array), an app-wide `prefetch.defaultStrategy` on `voidVue()` (default `false`), `hoverDelay` (75 ms) and `cacheFor`, plus `router.prefetch()`. Prefetching runs the destination's loader, so page data is prefetched as well as code. Links skip it on data saver or 2G. ([overview](https://void.cloud/guide/pages-routing/overview), [pages adapters](https://void.cloud/reference/api/pages))

Example of building it yourself:

Add `prefetch` to `<Link>`. It loads the destination's code and runs its loader before the click. Strategies are `hover`, `click`, `mount` and `visible`, and `prefetch.defaultStrategy` on `voidVue()` turns it on for every link.

```vue
<!-- components/BookLink.vue -->
<script setup lang="ts">
import { Link } from '@void/vue'
defineProps<{ id: string; title: string }>()
</script>

<template>
  <Link :href="`/${id}`" prefetch="hover">{{ title }}</Link>
</template>
```

Source: [Void: Prefetching](https://void.cloud/reference/api/pages#prefetching)

### Void (Svelte)

Label: **1st-party** (2 of 2 points).

`<Link href="/dashboard" prefetch>` from `@void/svelte`, with strategies `'hover' | 'click' | 'mount' | 'visible'` (or an array), an app-wide `prefetch.defaultStrategy` on `voidSvelte()` (default `false`), `hoverDelay` (75 ms) and `cacheFor`, plus `router.prefetch()`. Prefetching runs the destination's loader, so page data is prefetched as well as code. Links skip it on data saver or 2G. ([overview](https://void.cloud/guide/pages-routing/overview), [pages adapters](https://void.cloud/reference/api/pages))

Example of building it yourself:

Add `prefetch` to `<Link>`. It loads the destination's code and runs its loader before the click. Strategies are `hover`, `click`, `mount` and `visible`, and `prefetch.defaultStrategy` on `voidSvelte()` turns it on for every link.

```svelte
<!-- components/BookLink.svelte -->
<script lang="ts">
  import { Link } from '@void/svelte'
  let { id, title } = $props()
</script>

<Link href={`/${id}`} prefetch="hover">{title}</Link>
```

Source: [Void: Prefetching](https://void.cloud/reference/api/pages#prefetching)

### Void (Solid)

Label: **1st-party** (2 of 2 points).

`<Link href="/dashboard" prefetch>` from `@void/solid`, with strategies `'hover' | 'click' | 'mount' | 'visible'` (or an array), an app-wide `prefetch.defaultStrategy` on `voidSolid()` (default `false`), `hoverDelay` (75 ms) and `cacheFor`, plus `router.prefetch()`. Prefetching runs the destination's loader, so page data is prefetched as well as code. Links skip it on data saver or 2G. ([overview](https://void.cloud/guide/pages-routing/overview), [pages adapters](https://void.cloud/reference/api/pages))

Example of building it yourself:

Add `prefetch` to `<Link>`. It loads the destination's code and runs its loader before the click. Strategies are `hover`, `click`, `mount` and `visible`, and `prefetch.defaultStrategy` on `voidSolid()` turns it on for every link.

```tsx
// components/BookLink.tsx
import { Link } from '@void/solid'

export function BookLink(props: { id: string; title: string }) {
  return <Link href={`/${props.id}`} prefetch="hover">{props.title}</Link>
}
```

Source: [Void: Prefetching](https://void.cloud/reference/api/pages#prefetching)

---

HTML version: https://framework-compare.vercel.app/features/route-prefetching · All pages: https://framework-compare.vercel.app/llms.txt · Data: https://framework-compare.vercel.app/api/index.json
