I would like to press the Enter Key and send a message. I try this:
But there is an error.
<input type="text" className="form-control input-sm chat_input" placeholder="Write your message here..." onChange={this.handleTextChange} value={this.state.newMessage} /> <span className="input-group-btn"> <input type="submit" value="Send" className="btn btn-primary btn-sm" onSubmit={this.handleSendMessage} /></span> And I want to manage my function:
handleSendMessage = e => {} I already try OnKeyPressed but I can't call my functions there. Thank you.
I prefer a solution without jquery