The best practice is to keep state in the normalized shape, so instead of arrays, you would have objects indexed by id, and instead of storing comments inside messages you would store only ids.
For your example the state would look like this:
{
messages: {
byId: {
'1': { id: '1', comments: ['comment1'] },
...
},
allIds: ['1', ...]
},
comments: {
byId: {
'comment1': { id: 'comment1', ... },
...
},
allIds: ['comment1', ...]
}
}
In such structure in order to add a new comment you will have to update comments
part and add a new id in messages[id].comments
... but it's now much easier to update single comment.
For normalizing objects to such form I recommend normalizr.
More information about normalizing state shape in redux documentation Normalizing State Shape