const componentRef = useRef(null); const handleClick = () => { componentREf.current.scrollTo(0, 0); }; return ( <div ref={componentRef}> ... <button onClick={handleClick}> Reset scroll </button> </div> )