0

我使用 refs 来管理scroll事件

 <section ref={(tasks) => {
                this.tasks = tasks
              }}>

scrollIntoView用来滚动到一个特定divgoToTasks点击。

 goToTasks = () => {
    this.tasks.scrollIntoView({
    behavior: 'smooth',
    block: 'center',
    inline: 'center'
  })
  }

我想删除scrollIntoView. 当我转到下一页时。我在新页面中得到相同的滚动位置。

scrollIntoView我怎样才能删除删除componentWillUnmount

4

0 回答 0