我组件的
return方法具有以下代码段:
<List>
{items.length > 0
&&items.map((item,index) => (
<List.Item>
<Checkbox>
id={item.id}
onClick={handleCheckboxClick}
label={
<label>
<Preferencetag tagStyles={[styles.orange]}>
{item.name}
</Preferencetag>
</label>
}
<Checkbox/>
</List.Item>
))}
</List>
handleCheckBoxClick方法是这样的:
const handleCheckboxClick= async ()=> {
var id=this.id;
const result = await client.mutate({
mutation:deleteIndustry,variables:{
industryId:id
}
})
}
变异是:
const deleteIndustry=gql`
mutation deleteIndustry($industryId:String){
deleteIndustry(industryId:$industryId)
}
`
当我单击一个复选框时,出现以下错误: 未处理的拒绝(TypeError):无法读取未定义的属性“值”