For example,
constructor(props) {
super(props);
this.state = {
interactions: {
liked: [],
saved: [],
receivedLikeRecently: null
}
}
I'm trying to wrap my head around immutability, so if I wanted to now update receivedLikeRecently
to true
, would I have to do:
this.setState({
interactions: {
receivedLikeRecently: true
}
});
What about the other values? Do I need to include them as well?
According to the documentation setState does a shallow merge so I assume the other nested properties would not copy over right? Or am I misunderstanding?
Thanks