【发布时间】:2020-10-12 18:56:34
【问题描述】:
所以,我遇到了这个问题:我这里有这种类型的元素,显然在更改输入时有事件,是否可以传递这样的参数并访问事件?如果是这样,我该怎么做?
// this function accepts two other params index, stringValue
function onChange(index ,stringValue) {
console.log(event.target.value);
console.log("index?: " + index + " and value" + stringValue)
}
//this input is in Child Component
const index = 69;
const someRandomValue='iamstring';
<input defaultValue={name} onChange={onChange(index,iamstring)} />
【问题讨论】:
标签: reactjs typescript react-native