import { useEffect, useState } from 'react' const ScrollTopAndComment = () => { const [show, setShow] = useState(false) useEffect(() => { const handleWindowScroll = () => { if (window.scrollY > 50) setShow(true) else setShow(false) } window.addEventListener('scroll', handleWindowScroll) return () => window.removeEventListener('scroll', handleWindowScroll) }, []) const handleScrollTop = () => { window.scrollTo({ top: 0, behavior: 'smooth' }) } const handleScrollToComment = () => { document.getElementById('comment').scrollIntoView() } return (