小编jet*_*ski的帖子

如何向 React 中的 onChange 函数传递附加参数

所以,我遇到了这个问题:我这里有这种类型的元素,显然在更改输入时有事件,是否可以像这样传递参数并访问事件?如果是这样,我该怎么办?

// 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)} />
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-native

3
推荐指数
1
解决办法
8041
查看次数

从 MUI 输入组件中删除下划线(底部边框)

如何从这些输入中删除这些底线边框?我尝试在其上添加一些 CSS,但未成功组件 -> <Input type={"text} />

在此输入图像描述

javascript reactjs material-ui

2
推荐指数
1
解决办法
2273
查看次数