我使用 refs 来管理scroll
事件
<section ref={(tasks) => {
this.tasks = tasks
}}>
我scrollIntoView
用来滚动到一个特定div
的goToTasks
点击。
goToTasks = () => {
this.tasks.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center'
})
}
我想删除scrollIntoView
. 当我转到下一页时。我在新页面中得到相同的滚动位置。
scrollIntoView
我怎样才能删除删除componentWillUnmount