const Row = [ { name: "jad", link :"/jad", calories :"52", Fat :"4", Carbs :"5", Protein :"41" }, { name: "john", link :"/john", calories :"82", Fat :"42", Carbs: "35", Protein :"1" } ] const [myList, setMyList] = React.useState(Row); function handle(){ setMyList() }{ myList.map((item)=> { return ( ) }) } {item.name} {item.calories} {item.Fat} {item.Carbs} {item.Protein} }> Delete
透過循環解析
myList
,找到特定的鍵,更新鍵的新值,然後使用更新後的myList
setMyList
。