reactjs - Reactjs - 具有不同数量参数的 handleChange
问题描述
我正在尝试制作一个可编辑的简单数据表。
本质上,我想弄清楚我的handleChange
函数是否可以接受不同数量的参数?
例如,有没有办法我可以做这样的事情并能够从我的TextInput
?
<TextInput
name={this.props.headers[i-1].id}
onChange={(event) => this.onInputChange(row.id, this.props.headers[i-1].id, event)}
disabled={(this.isBeingEdited(row.id) === false)}
value={row[rowKeys[i]]}
/>
我TextInput
的handleChange
看起来像这样:
handleChange = event => {
var value = event.target.value;
this.setState({ value: value }, () => this.checkForErrors());
this.props.onChange(this.props.name, value);
}
现在,它只是给我this.props.name
,value
但我也想要row.id
谢谢你的帮助!
解决方案
推荐阅读
- javascript - 在 amp 页面中,是否可以包含在 window.onload 之后执行代码的 .js 文件?
- python - 在python中从单精度转换时将双精度设置为零
- macos - 如何允许通过终端发送 kystrokes?
- mysql - OpenJPA - 如何制定工作策略=针对 Oracle 的序列和策略=针对 MySql 的身份
- c# - 如何从我的 Ocelot api 网关中隐藏 JWT 密钥?
- google-apps-script - 部署为附加组件时,Apps 脚本引发权限异常
- python - 找不到错误
- tensorflow - 如何将 seq2seq 和注意力模型转换为可以部署在 Android Studio 中的 .tflite 格式?
- python - 根据第 3 列在列中设置具有共同值的行的日期
- java - Spring Boot AWS paramstore:删除配置文件后缀