W
W
webpct2018-11-21 16:58:45
JavaScript
webpct, 2018-11-21 16:58:45

What is the difference in method declaration?

class TripHistory extends Component {

    scrollHandler = throttle((e) => {
        console.log(e);
    }, 300);
}

class TripHistory extends Component {

    constructor(){
        super(props);
        this.scrollHandler = throttle(this.scrollHandler,300)
    }

    scrollHandler = (e) => {
        console.log(e);
    }
}

The question is, what is the difference between these two methods? Why e.persist()? And how to properly troll React SyntheticEvent.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question