更新 React 状态下的数组对象

Updating the array object in React state

我的状态是,

 this.state = {
tempData: [{
        "data": [{"id": "a1", "seatNo": 0},{"id": "a2", "seatNo": 0}],
        "rowName": "a",
    },{
        "data": [{"id": "b1", "seatNo": 0},{"id": "b2", "seatNo": 0}],
        "rowName": "b",
    }]}

我想在事件中用它的 id 更新特定 seatNo 的值。

像这样尝试在自定义事件中更新状态

onclickevent=(eventid)=>{
   let data=[...this.state.tempData]
   data.map(el=>{
   el.data.map(al=>{
       if(al.id===eventid){
        al.seatNo="update the seat number"
       }
   return null
    })
    return null
    })
   this.setState({tempData: data})
}