I am having an onKeyPress Listener to my input component. Currently onKeyListener prints something when the enter key is hit.
This is current code
onKeyPress={this.onHitEnter.bind(this)}/>
onHitEnter = (e) => {
if (e.key === 'Enter') {
console.log()
}
Now I want to send some addition params to onHitEnter method. I tried to do it but it didn't work
This is what I tried
onKeyPress={this.onHitEnter.bind(this, item, item.id, item.index)}/>
onHitEnter = (e, item, id, index) => {
if (e.key === 'Enter') {
console.log("enter")
console.log(id)
}
How can I send those additional parameters to onHitEnter method?