所以,我遇到了这个问题:我有这种 Element 类型的元素,当输入改变时,显然会触发事件,能否像这样传递参数,并访问事件呢?如果可以,我该怎么做呢?
// 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)} />