xxxxxxxxxx
const topRef = useRef(null);
const scrollToTop = () => {
topRef.current.scrollIntoView({ behavior: 'smooth' });
};
return (
<div ref={topRef}>
.
<a onClick={() => scrollToTop(topRef) } > go Top ! </a>
</div>
);