1

My Next SPA is fetching a 3D Map and data from an API. Is there a way to add a loading banner showing the current percentage of files/components/data loaded before the app is fully loaded?

I'm looking for something similar to this: Calculate & Display percentage of progress of page load

juliomalves
  • 42,130
  • 20
  • 150
  • 146
karl
  • 71
  • 1
  • 8

1 Answers1

3

I’m thinking of 2 ways to do this, depending on if the data is being fetched during runtime of your app or your app depends on it from root:

  1. By using a server side fetcher using a hook (see load splash screen before nextjs)
  2. By fetching the data manually (e.g. literally with fetch), after your app has loaded and tracking progress with response.body when using fetch (see https://javascript.info/fetch-progress for reference)
prohit
  • 609
  • 1
  • 6
  • 18