I used refs to manage the scroll
event
<section ref={(tasks) => {
this.tasks = tasks
}}>
I am using scrollIntoView
to scroll to a particular div
on a goToTasks
click.
goToTasks = () => {
this.tasks.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center'
})
}
I want to remove the scrollIntoView
. When I move to the next page. I get the same scroll Position in the new page.
How can I remove the remove scrollIntoView
in componentWillUnmount