Can we update state properties to a different data type than before?

Question

In the context of this exercise, can we update state properties to a different data type than what they were before?

Answer

Yes, by default, there is no restriction as to the data types that the properties must be set to, and they do not have to stay the same data type they were initialized to.

So, if you initially had the state

this.state = {
  mood: 'great'
}

you could update its value to some different data type, for instance,

this.state = {
  mood: false
}
2 Likes