Quantcast
Channel: React utility function to bind this keyword - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by Kubilay Kiymaci for React utility function to bind this keyword

$
0
0

if you don't want to writing bind in the constructor, you can write your event with arrow function.

render()
return <input onKeyPress = {() => 
this.handleOnKeyPress() }/>
 } 

After that you can delete your binding code line of component.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>