Last active
August 26, 2022 22:27
-
-
Save malerba118/c0f76c62f416feb9cd3d5e69f69fba1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useScroll } from 'framer-motion'; | |
const Navbar = () => { | |
const scroll = useScroll(); | |
const [timeRemaining, setTimeRemaining] = React.useState(readTime); | |
React.useEffect(() => { | |
return scroll.scrollYProgress.onChange((progress) => { | |
setTimeRemaining(Math.floor(readTime * (1 - progress))); | |
}); | |
}, []); | |
return <div>{/* ... */}</div> | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment