I have the following class snippet:
constructor(props) { super(props); this.timeout = null; } search = (e) => { clearTimeout(this.timeout);
Try this:
search = (e) => { e.persist(); clearTimeout(this.timeout); this.timeout = setTimeout( function(){ console.log(e); alert(e) }, 500 );
}
Judging from your code I think that you are using babel-plugin-transform-class-properties. In that case you don't need a constructor part.