How to add scroll event in react component

前端 未结 6 1979
逝去的感伤
逝去的感伤 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:17

    according to React documents(https://reactjs.org/docs/handling-events.html),

    React events are named using camelCase, rather than lowercase. You can set attributes as you do with pure HTML.

    HTML:

    ...

    JSX:

    ...

    you should create a wrapper block element which has fixed height to enable scroll.

提交回复
热议问题