DEV Community

Discussion on: How to create a Preloader in Next.js

Collapse
 
arshkkk profile image
arshkkk

Hardcoding the loading time isn't the best way, it's false loading
Because In nextjs production things are very fast, user will be waiting unnecessarily for each page change

Instead you can use router events in nextjs

nextjs.org/docs/api-reference/next...

Collapse
 
seven profile image
Caleb O. • Edited

Hi @arshkkk ,

I'm not making the preloading screen show on each page change. Just when the page is first mounted to the DOM.

But, I'll definitely check the link you shared here. Thank you for sharing it 😎