0
0
0348raven2016-04-07 11:15:21
React
0348raven, 2016-04-07 11:15:21

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

1 answer(s)
K
KnightForce, 2017-05-15
@KnightForce

document.body.sccrollTop=0;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question