Reader small image

You're reading from  Full Stack Web Development with Remix

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781801075299
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Andre Landgraf
Andre Landgraf
author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf

Right arrow

Prefetching data

In this section, we will learn how to prefetch assets and loader data in Remix and how to utilize prefetching to speed up transition times.

Remix compiles the routes folder into a routing hierarchy at build time. The hierarchy information is stored in an asset manifest in the public folder. This asset manifest is used by both Remix’s frontend and backend applications.

Since Remix has access to the asset manifest on the client, Remix knows in advance which loader functions to call to transition to a route. This allows Remix to prefetch loader data (and route assets) before the transition.

Enabling prefetching in Remix is as easy as setting a prop on the link we want to prefetch data for:

  1. Open the /app/routes/dashboard.tsx file in your editor.
  2. Add the prefetch property to the Income and Expenses navigation links:
    <ul className="mt-10 w-full flex flex-row gap-5">  <li className="ml-auto">  ...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Remix
Published in: Nov 2023Publisher: PacktISBN-13: 9781801075299

Author (1)

author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf