javascript - how to pass default event argument and an argument in react? -


this function want invoke in input type:

_handleonenterpress = (e, receiveruserid) => {      if (e.keycode === 13) { // guess keycode 13 enter?        console.log("pressed enter. user id = ",receiveruserid)      }   }; 

and input type want invoke when enter pressed, used onkeydown

<input classname="popup-input"    onkeydown={this._handleonenterpress(chatfriendpoppup.id)}    onchange={this._handlemessagetextchange}    type='text' /> 

when press enter, it's not logging on console. used e(event) default arg can detect keycode 13 (enter) guess if fails? since receiveruserid on 2nd index, not have pass e (event) arg on onkeydown when function invoked?

have tried onkeydown={(e) => this._handleonenterpress(e, chatfriendpoppup.id)} ?


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -