I have a state that looks like this:
attributes: [
{name: "capacity", items: [{ value: '256GB'},{value: '512GB'}]},
{name: 'With USB 3 ports', items: [{value: 'Yes'}, { value: 'No'}]}
]
I want to create a function which takes 2 paramaters, for example "capacity" and "256GB", I want to iterate over attributes state and find the object where the value property is 256GB and add another property in that object.
so I want the state to look like this:
attributes: [
{name: "capacity", items: [{ value: '256GB', selected: true},{value: '512GB', selected: false}]},
{name: 'With USB 3 ports', items: [{value: 'Yes'}, { value: 'No'}]}
]