title: Rest call at componentDidMount
body: <p>I am call a REST service in my React component's componentDidMount:</p>
  
  <pre><code>loadData: function () {
      return $.getJSON(this.props.server+"/xxxxx/"+this.props.params.promotionid);
  
  },
  componentDidMount: function () {
      this.loadData().success(function (data) {
          console.log("After success");
          console.log(data);
          if(this.isMounted())
          {
              this.setState({
                  prom: data
                  //release: data.Release
              });
          }
      }.bind(this))
  }
  </code></pre>
  
  <p>This works even without documentation suggestion to include an if(this.isMounted()), there. Plesee note the commented line. We will need to comment this out in order to work. The thing is that if the data I get from the server has a subobject in it, it does not work even with the isMounted(). eg:</p>
  
  <pre><code>{
  PromotionId: 1,
  Description: "Hello three",
  Category: "serviceid",
  SpecialID: 23666,
  ProjectManager: "Tarkidi Touvouda",
  Requestor: "George Klapas",
  Readiness: false,
  SignOff: false,
  SourceDestination: "developement-uat",
  Status: "pending",
  ReleaseId: 2,
  Release: {
      ReleaseId: 2,
      ReleaseName: "Fall Second",
      ReleaseDate: "2015-10-05T00:00:00",
      ReleaseDeadline: "2015-10-05T00:00:00",
      ModifiedDate: "2015-10-21T12:48:45.753"
  },
  PromotionAssets: null,
  ModifiedDate: "2015-10-21T12:48:45.753"
  </code></pre>
  
  <p>}</p>
  
  <p>I get the data at render() as follows</p>
  
  <pre><code>var p=this.state.prom;
  var rel=p.Release;
  </code></pre>
  
  <p>I get an error when I try to access rel.ReleaseName that cannot find Releasename of undefined. The only way to make it work is removing the comment you saw (that is to say, having a separate field in state that will hold Release object) and then :</p>
  
  <pre><code>var rel=this.state.release;
  </code></pre>
  
  <p>Subsequent calls to Release object are successful. Why should I do that? I mean have a separate state field for this?</p>