vendredi 11 mai 2018

In react.js, I want to use ref.scrollTop instead of document.body.scrollTop

in below code i am using javascript DOM but instead of this i want to use ref from react but i don't know how can i use ref for body.

handleChange = (event, value) => {
        this.setState({ tab: value }, () => {
            const element = document.getElementById(this.tabs[value]);
            document.body.scrollTop += element.getBoundingClientRect().y - 110;
        });
    };




Aucun commentaire:

Enregistrer un commentaire