State

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) { 
    super(props);
    this.state = {date: new Date()};
  }



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