react中怎么监听keycode事件

2025-05-20 20:44:04
推荐回答(1个)
回答(1):

//监听内容的变化并且记录在状态中
handleChange: function(event){
this.setState({inputText: event.target.value});
},
//添加提交按钮并打印结果
handleSubmit: function () {
console.log("reply To" + this.props.selectName + "\n"
+ "\n" + this.state.inputText);
},