【发布时间】:2021-02-19 09:47:33
【问题描述】:
我想根据 id 更改检查值,请帮我解决这个问题。我将传递一个 id,它必须在 sub_cat 中的每个对象中匹配,如果找到任何结果,则更改检查值
"data": [
{
"id": "1",
"name": "Electrical Repair & installation",
"parent_id": "0",
"image": "assets/images/Group66.png",
"checked": "false",
"sub_cat": [
{
"id": "7",
"name": "Sockets",
"parent_id": "1",
"image": "assets/images/Group66.png",
"checked": "false"
},
{
"id": "8",
"name": "Fans",
"parent_id": "1",
"image": "assets/images/Group67.png",
"checked": "true"
}
]
},
]
【问题讨论】:
-
请添加您的尝试。还要添加预期的输出。
标签: javascript arrays react-native object