State is similar to props, but it is private and fully controlled by the component.

States should only be used attributes that need to change
A parent can pass in props to set the default values for the state during construction.

State is a feature only available in classes.

  constructor(props) { 
    this.state = {date: new Date()};

© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext