Preload (prefetch) assets in Next.js

241 Views Asked by At

I developed this Next.js (app router) application that renders something like a simple flash card memory game. The game consists of many assets including images, audio etc. How can I preload these assets so that the user doesn't wait for the audio file to be downloaded when an event happens in the game? I'm planning to run this prefetching task while displaying a loading page.

I tried downloading them using the Next.js Link and Image components in the parent component but it may not be the best way to go.

0

There are 0 best solutions below