React.jsでScrollアニメーションの追加方法

1 min read読了の目安(約300字

(1)yarn add react-scroll

(2)

index.tsx
import { animateScroll as scroll } from 'react-scroll'

const Home: React.FC = () => {
  const scrollToTop = () => {
    scroll.scrollToTop()
  }
  return (
	<div className={styles.container}>
	  <BackButton className={styles.backButton} onBackClick={scrollToTop} />
	</div>