【发布时间】:2018-01-11 13:10:12
【问题描述】:
通过下面的代码,我试图在 ReactJS 应用程序中使用 onKeyDown 事件调用两个不同的函数。
但它没有调用任何这些功能。但是,它只需一个函数调用就可以正常工作。
<input name="product_quantity"
type="text"
onKeyDown={ (event) => {
this.props.handleInputNumber;
this.handleQuantity; } }
value={ this.state.item.product_quantity }
className="form-control"
/>
【问题讨论】:
-
(event) => { this.props.handleInputNumber(event); this.handleQuantity(event); } -
您确定不需要
event参数...? -
不,你是对的,。没有事件它不会工作。
标签: javascript reactjs