My task involves working with a simple array of string ids and objects. Upon initial load, I am matching these Ids
with the objects and setting the checked
property to true
.
const Ids = ['743156', '743157']
[
{
"id": "743156",
"role": "Authorized Redistributor (AR)",
"checked": true,
"checkBoxPatched": true
},
{
"id": "743157",
"role": "System Of Record (SOR)",
"checked": true,
"checkBoxPatched": true
},
{
"id": "743158",
"role": "Authorized Redistributor (AR)",
"checked": false,
"checkBoxPatched": true
},
{
"id": "743159",
"role": "System Of Record (SOR)",
"checked": false,
"checkBoxPatched": true
},
{
"id": "743976",
"role": "Authorized Redistributor (AR)",
"checked": false,
"checkBoxPatched": true
},
]
As the user interacts with the checkboxes and updates them, they have the ability to change the checked
value, potentially affecting other objects. My goal is to identify which objects have their checked
property set to true, excluding the initial two objects that were checked.
If there are no new checkboxes checked by the user, I expect an empty object {}. I do not want the initially checked checkboxes with ids 743156 & 743157
to be included in the result.
{
"id": "743157",
"role": "System Of Record (SOR)",
"checked": true,
"checkBoxPatched": true
},
{
"id": "743158",
"role": "Authorized Redistributor (AR)",
"checked": true,
"checkBoxPatched": true
}