So say I have an array like so:
this.state = {
students: [{
"company": "This",
"firstName": "Randy",
"id": "1",
"lastName": "Orton",
},
{
"company": "That",
"firstName": "Clark",
"id": "2",
"lastName": "Kent",
}]
}
I would like to add an array to the first object so it looks like this.
this.state = {
students: [{
"company": "This",
"firstName": "Randy",
"id": "1",
"lastName": "Orton",
"array" : []
},
{
"company": "That",
"firstName": "Clark",
"id": "2",
"lastName": "Kent",
}]
}
How can I go about doing that without messing with initial state but only update it?