Answer the question
In order to leave comments, you need to log in
How to return to the clicked place?
Hello. I have a table with n-number of rows.
I click on any of the lines and I am transferred to the route/matreix/some/:id
cancel = () => browserHistory.push(`/matreix/some`)
Cancel
, it will transfer me to the top of the table to the first element, and I want something to transfer me to the height (where the element is located) where I clicked. Answer the question
In order to leave comments, you need to log in
Solved the problem like this
componentDidMount() {
window.addEventListener('scroll', this.handleScroll);
}
componentWillUnmount() {
window.removeEventListener('scroll', this.handleScroll);
}
handleScroll = (event) => {
let scrollTop = event.srcElement.body.scrollTop,
itemTranslate = Math.min(0, scrollTop/3 - 60);
console.log(itemTranslate);
this.setState({
transform: itemTranslate
});
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question