onmouseover not working with React.js

后端 未结 2 1993
情书的邮戳
情书的邮戳 2021-01-01 16:52

The click event works fine, but the onmouseover event does not work.

ProfImage = React.createClass({

    getInitialState: function() {
        return { sh         


        
相关标签:
2条回答
  • 2021-01-01 17:33

    Both the answers above are correct, but you need to bind these method to the class context too!

    <img src="/images/profile-pic.png" height="100" onClick={this.onClick.bind(this)} onMouseOver={this.onHover.bind(this)} />
    
    0 讨论(0)
  • 2021-01-01 17:40

    You need to capitalize some of the letters.

    <img src="/images/profile-pic.png" height="100" onClick={this.onClick} onMouseOver={this.onHover} />
    
    0 讨论(0)
提交回复
热议问题