/* Root app */ const { useState: uSA, useEffect: uEA } = React; function ScrollProgress() { const [w, setW] = uSA(0); uEA(() => { let raf = 0; const update = () => { raf = 0; const h = document.documentElement; const max = h.scrollHeight - h.clientHeight; setW(max > 0 ? (h.scrollTop / max) * 100 : 0); }; const onScroll = () => { if (!raf) raf = requestAnimationFrame(update); }; update(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, []); return
; } function App() { return (