What is the best practice in React to push a new object to an array within an object that doesn't have a key and then have the state update? I'm currently able to update it, but it's mutating the state which I know is not a best practice. I'd like to be able to use this.setState so my component re-renders. Thanks!
currentState = {
lorem: [
{
id: 123,
title: 'quis nostrud'
ipsum: [
{
dolor: 0,
amet: 0
}
]
},
{
id: 456,
title: 'occaecat cupidatat'
ipsum: [
{
dolor: 0,
amet: 0
}
]
}
]
}
desiredState = {
lorem: [
{
id: 123,
title: 'quis nostrud'
ipsum: [
{
dolor: 0,
amet: 0
},
{
dolor: 100,
amet: 100
}
]
},
{
id: 456,
title: 'occaecat cupidatat'
ipsum: [
{
dolor: 0,
amet: 0
}
]
}
]
}