Answer the question
In order to leave comments, you need to log in
How to do without state?
to define scrolling (up/down) I use a function that hangs on the 'scroll' event.
scrollUpDown() {
if (this.state.lastScrollPos < getScrollTop() ) {
this.setState({lastScrollPos: getScrollTop()});
console.log('down')
}
else if (this.state.lastScrollPos > getScrollTop() ) {
this.setState({lastScrollPos: getScrollTop()});
console.log('up')
}
}
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