Skip to content

Commit

Permalink
docs(<Link prefetch>): clarify that prefetch is on by default (#6276)
Browse files Browse the repository at this point in the history
  • Loading branch information
maiieul committed May 7, 2024
1 parent 97757d5 commit ce8a1c0
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/docs/src/routes/docs/(qwikcity)/routing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,11 @@ export default component$(() => {
### `<Link prefetch>`

The Link component's `prefetch` prop can be used to improve the perceived performance of the application. Although Qwik pages excel at lazy loading javascript, this feature can come in handy for content-heavy pages or SSR pages that need to wait for database or API calls.
By default, a `Link` component will start prefetching the next page as soon as the user hovers over the corresponding link in the UI. So if the application is done prefetching when the user clicks on the link, the next page will appear instantly. Although Qwik applications already excel at lazy loading javascript, this behavior can come in handy for content-heavy pages or SSR pages that need to wait for database or API calls.

If this is not your desired behavior, you can set the `prefetch` prop to false.
```tsx
<Link prefetch href="/about">About</Link>
```

By simply adding the `prefetch` prop, your Link component will start prefetching the page as soon as the user hovers over the link. If the application is done prefetching when the user clicks on the link, the following page will appear instantly.
If prefetching is not desired, you can set the prefetch value to false.
```tsx
<Link prefetch={false} href="/about">About</Link>
<Link prefetch={false} href="/about">About</Link>
```

### Scroll Restoration
Expand Down

0 comments on commit ce8a1c0

Please sign in to comment.