[react.js] リアクトでイベントリスナー


const element = findDOMNode(this.refs.element);
element.addEventListener('mouseover'),(e)=>{
this.mouseover(e);
});
element.addEventListener('mouseout'),(e)=>{
this.mouseout(e);
});

こうしてあげる


this._mouseover = this.mouseover.bind(this);
this._mouseout = this.mouseout.bind(this);

const element = findDOMNode(this.refs.element);
element.addEventListener('mouseover'),(e)=>{
this._mouseover(e);
});
element.addEventListener('mouseout'),(e)=>{
this._mouseout(e);
});