If there is data with the same key in one of the other State Objects, I want to overwrite it.
Here's an example:
As you can see from the code, if there are content1, content2, and the key values in content1 and content2 are the same, I want to change it to the content2 coin value.
console.log(content1)
[
{
key: 1,
coin:0
},
{
key: 2,
coin: 0
},
{
key: 3,
coin: 0
},
]
console.log(content2)
[
{
key: 2,
coin: 400
}
]
The result I want is this:
console.log(content1)
[
{
key: 1,
coin:0
},
{
key: 2,
coin: 400
},
{
key: 3,
coin: 0
},
]
I've tried using the map and find functions by myself, but I can't solve it by myself, so I'm asking a question.