Adding a progress bar to load pages
It's true that with an SPA the user does not have to wait for a new page to load, but he still has to wait for the data to load. In the Fetching data before switching route recipe, we had to wait a while longer after we clicked on the button to the /aboutme
page. There was nothing to suggest that the data was loading, and then suddenly the page appeared. Wouldn't it be great if the user had at least some feedback that the page is loading?
Getting ready
In order to follow along, you should complete the Fetching data before switching route recipe.
This recipe will build up on top of it and I'll assume that you have all the relevant code in place already.
How to do it…
As stated earlier, I will assume that you have all the code resulting from the Fetching data before switching route recipe in place and working.
For this recipe, we will use an additional dependency--NProgress
, a small utility to display a loading bar on top of the screen.
Add the following two lines...