score:3

Accepted answer

either you can set the props value as default values using defaultprops:-

    export default class name extends component {
      static defaultprops = {
            name: "name default value",
            email: "email default value"  
          };

          constructor(props) {
            super(props);
            this.state = {
             name: this.props.name,
             email: this.props.email,
             // some other variables

            };
          }
...... ..........
...... ..........
}

or

you can update your props value in componentwillreceiveprops() method, this method will execute every time your props value changes either coming from server or something. like below:-

componentwillreceiveprops(nextprops) {
    if (!this.props.name && nextprops.name) {
     // here you can do according to your need
     // you can update the values of variables in state here 

    this.setstate({ name: nextprops.name });

    }
  }

Related Query

More Query from same tag