How to add scroll event in react component

前端 未结 6 2027
逝去的感伤
逝去的感伤 2021-01-03 20:39

I\'m trying to add an onScroll event on a table. This is what I\'ve tried:

componentDidMount() {
    ReactDOM.findDOMNode(this.refs.table).addEv         


        
6条回答
  •  滥情空心
    2021-01-03 21:05

    You can use onScroll attribute:

    listenScrollEvent() {
        console.log('Scroll event detected!');
    }
    
    render() {
        return (
            
               [...]
            
    ) }

    Here is an example: https://jsfiddle.net/81Lujabv/

提交回复
热议问题