How do you update a certain nested property in redux state?
Let's say I only want to update the "value" property in the object below. I know you shouldn't deep copy the previous state but how do i only change the property of an object in an array in an object of an array?
Thanks in advance!
market {
shops: [
{
name: 'abc',
items: [
{
name: 'item1',
value: 40,
id: '234rfds32'
},
{}
]
},
{},
{}
]
}
Something like the following:
state = {
...state,
shops: [
...state.shops,
shops[index].items = [
...shops[index].items,
]
]
};
market.shops[0].items[0].value = 10is this what you are looking for?