I am trying to implement an infinite scroll in my chat widget. I have a ref setup for chat body's container like this:
const containerNode = ReactDOM.findDOMNode(this.refs.container)
I also already setup an event listener that handle's the scroll:
containerNode.addEventListener('scroll', this.handleScroll);
I am now trying to find out how to implement the use case where before i can scroll up, it would make an ajax call.
handleScroll() {
console.log("make an ajax call before it scrolls all the way up")
if (some_conditon){
//then load more!
}
}
