Próximo carregador de página JS
// Use the isLoading variable to show or hide your loader
const [isLoading, setIsLoading] = useState(false)
useEffect(() => {
const handleStart = () => {
setIsLoading(true);
};
const handleComplete = () => {
setIsLoading(false);
};
router.events.on("routeChangeStart", handleStart);
router.events.on("routeChangeComplete", handleComplete);
router.events.on("routeChangeError", handleComplete);
}, [router]);
Zealous Zebra