I am working with a basic array of photo categories that follows this structure:
[
{
category: 1001,
photos: [
{ id: 100101, url: 'url.com/100101', favorite: false},
{ id: 100102, url: 'url.com/100102', favorite: false}
]
},
{
category: 1002,
photos: [
{ id: 100201, url: 'url.com/100201', favorite: false},
{ id: 100202, url: 'url.com/100202', favorite: false}
]
}
]
If I decide to mark the photo with ID 100201 as a favorite, how can I go about updating my array so that 100201 is now set to favorite: true
? I've been attempting to consult the lodash documentation for assistance, but I'm unsure of what exactly to search for.
Any help would be greatly appreciated. Thank you!