So I have some data that looks something like this:
const somedata = {
abc: [
{number: 1, letter: "a"},
{number: 2, letter: "b"},
{number: 3, letter: "c"},
{number: 4, letter: "d"},
]
}
I filter out the object that I want like so:
const currentItem = somedata.abc.filter((item) => item.number === 1);
Which returns this:
[{number: 1, letter: "a"}]
At this point - I'd like to update a value - Something like this, but I'm not sure this is the best way?
currentItem[0].number = 100
Which returns this:
[{number: 100, letter: "a"}]
I'd then like to replace that object in somedata.abc - This is where I'm getting stuck. Any help would be really great!!
Thanks a lot