james changes

This commit is contained in:
ingawei 2022-09-30 13:10:59 -07:00
parent 54b031ac35
commit 5aa889fb08

View File

@ -7,6 +7,7 @@ export function ScrollToTopButton(props: { className?: string }) {
const { className } = props
const [visible, setVisible] = useState(false)
useEffect(() => {
const onScroll = () => {
if (window.scrollY > 500) {
setVisible(true)
@ -14,8 +15,6 @@ export function ScrollToTopButton(props: { className?: string }) {
setVisible(false)
}
}
useEffect(() => {
window.addEventListener('scroll', onScroll, { passive: true })
return () => {