import { useEffect , useRef } from 'react' ; interface Props { open ? : boolean ; className ? : string ; } export const SlideBox = function SlideBox ( { children , className } ) { const divRef = useRef < HTMLDivElement > ( null ) ; useEffect ( ( ) => { const div = divRef . current ; function handleScroll ( ) { if ( div ) { div . scrollLeft = 0 ; div . scrollTop = 0 ; } } if ( div ) { div . addEventListener ( 'scroll' , handleScroll ) ; } return ( ) => { if ( div ) { div . removeEventListener ( 'scroll' , handleScroll ) ; } } ; } , [ ] ) ; return ( < div ref = { divRef } className = { className } > { children } < /div>); } ;