I have a parent component with its state like this:
var db = {
one: {
name: 'xyz',
color: 'blue',
seen: false
},
two: {
name: 'abc',
color: 'red',
seen: false
},
........and so on many objects
};
this.state = { ...db };
Now when i update only 1 of these objects, all of the parent element is re rendered. how can i avoid this and only render that part which changed. How should i set state (which way/method) so that the shallow comparison that react does returs true only for that particular element object and not for the whole state object?
currently, this is how i am setting my state:
this.setState(state => {
state[objectKeyName] = _editedObject;
});