[英]How can bind the "areaName" on <TexBox> vlaue=" " and onChange=" ":?
Actually, I have called an API and map the array and bind the data on <TableCell>
实际上,我已经调用了一个 API 并映射了数组并将数据绑定到<TableCell>
{this.state.allArea.map((allArea, i) => (
<TableRow >
<TableCell >{allArea.areaName}</TableCell>
<TableCell >{allArea.cityName}</TableCell>
<TableCell > <IconButton aria-label="edit" onClick=
{this.addCoupon.bind(this)} >
<EditIcon />
</IconButton><IconButton aria-label="delete">
<DeleteIcon />
</IconButton></TableCell> </TableRow>
))}
But Now, I want to edit/update the areaName
so I create a <TexBox>
但是现在,我想编辑/更新areaName
所以我创建了一个<TexBox>
<Grid container spacing={8}>
<Grid item md={12} sm={12} xs={12} >
<TextBox error='' value='' name="name" label="Area name" required={true} onChange={this.handleAreaChange.bind(this)} ></TextBox>
</Grid>
</Grid>
but I am unable to bind areaName at value=""
and onChange=''
但我无法在value=""
和onChange=''
处绑定 areaName
Define like this像这样定义
<TextBox error='' value={areaName}
name="name" label="Area name"
required={true} onChange={this.handleAreaChange} >
</TextBox>
handleAreaChange
function handleAreaChange
函数
handleAreaChange=e=>{
this.setState({areaName:e.target.value})
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.