import { useState, useEffect } from 'react' export default function ScrollToTop() { const [isVisible, setIsVisible] = useState(false) useEffect(() => { const handleScroll = () => { setIsVisible(window.scrollY > 200) } window.addEventListener('scroll', handleScroll) return () => window.removeEventListener('scroll', handleScroll) }, []) const scrollToTop = () => { window.scrollTo({ top: 0, behavior: 'smooth', }) } return ( ) }