Answer the question
In order to leave comments, you need to log in
How to scroll to the top of a container in React?
I understand what can be done with regular js, but something went wrong. I provide the complete code of the component.
import React, { PropTypes } from 'react';
class CompanyScrollToTop extends React.Component {
render (){
return(
<div onclick={this.scrollToTop} className="arrow-scroll-to-top visible-tablet">
</div>
);
}
_scrollToTop() {
const elTop = document.querySelector('.application__wrap');
elTop.scrollTo(0, 0);
};
}
export default CompanyScrollToTop;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question