I wish to update an objects in an array using immutable.js
My object looks like this:
{
location: '',
cars: [
{id: 1, color: blue},
{ id: 2, color: red}
]
};
In my code I get for example car id: 2 and change the color { id: 2, color: black}
I now wish to update the car which is at index 1 .
I tried :
const car = { id: 2, color: black}
updateIn([ 'cars' ], list => list.push(car));
This will only add a new car at the end.
Which function in Immutable JS can I use to update car id # 2.
What’s the correct way to do this with immutable.js
updateIn()on?