I have a somewhat complex state as follows:
array:
array:
object,
object,
etc...
array:
etc...
Simply put, an array containing a number of arrays that hold objects. I am trying to find one of these objects inside this mess according to its Id and update it (namely setting a completed value to true), but haven't been able to so far. Using Mudash, I managed to find this object, but I have no idea how to pass it up again to return it, my code is as follows:
return state.update('data', (arr) => {
_.forEach(arr, function(item) {
_.forEach(item, function(elt) {
if(elt.Id == action.Id) {
console.log('Item Found');
elt.set('completed', true);
}
});
});
return arr;
});
Is there some simple way to accomplish this? Thank you.