I have an array of objects in the state with the following structure:
const arrayOfTests = [
{
id: 1,
name: "test1",
description: "test description"
},
{
id: 2,
name: "test2",
description: "test description"
},
{
id: 3,
name: "test3",
description: "test description"
}
]
Lets say I find object with id of 3 like this:
let object3 = arrayOfTests.find((element) => {
return element.id === 3;
})
And then I edit it like this:
object3.description = "new description"
I'm kinda confused how to use setState to replace/edit the old object 3, with the new updated one.