title: ReactJS Show Component Once Data in State is not Null
body: <p><strong>EDIT:</strong> So I was having some troubles with stack overflow and had to retype some things.... including Weather weatherData={this.state.weatherData} which I accidentally typed incorrectly on here as Weather weatherData={weatherData}. But I did also make a typing mistake on my code and that was with setState. I am new to reactjs and some of the syntax I find weird so that's probably why I have syntax errors. So I ended up fixing things, but was still having an error "this.setState is not a function". I figured maybe it was a scope problem so I made a new method updateWeatherData, and voila that worked. </p>
  
  <p>So I am trying to make a weather app. What I want to do is load the child component called Weather once there is data in this.state.weatherData. I have checked with a console.log and the data is coming back from the ajax call but I can't seem to set it. The error message I am getting is "Cannot read property 'weatherData' of undefined"</p>
  
  <pre><code>var React = require('react');
  var Weather = require('./Weather');
  
  
  class App extends React.Component{
      constructor(props)
      {
          super(props);
          this.state = {
              weatherData: null,
          };
          this.getDataFromLatLng = this.getDataFromLatLng.bind(this);
          this.showPosition = this.showPosition.bind(this);
      }
      updateWeatherData (results)
      {
          this.setState({
              weatherData:results
          });
      }
      componentDidMount()
      {
          if (navigator.geolocation) {
              navigator.geolocation.getCurrentPosition(this.showPosition);
  
          } else {
              alert("Geolocation is not supported by this browser.");
          }
      }
      showPosition(position)
      {
          this.getDataFromLatLng(position.coords.latitude, position.coords.longitude);
      }
      getDataFromLatLng(lat, lng)
      {
          $.ajax({
              url: 'http://api.openweathermap.org/data/2.5/weather?lat='+lat+'&amp;lon='+lng+"&amp;units=metric&amp;appid=ID",
              type:"GET",
              dataType:"jsonp",
               //CHANGED FROM THIS:
              /*success:function(results){
                  //RESULTS COME BACK
                  console.log(results);
                  this.setState=({
                      weatherData:results
                  });
                  console.log(this.state.weatherData);
                  //But no weatherData is being set
  
              },*/
              //TO THIS:
              success:this.updateWeatherData,
              error: function(xhr, status, error) {
                console.log(xhr.responseText + " " + status, " " + error);
              }
          });
      }
      render()
      {
          return(
              &lt;div id="container"&gt;
                  Hello From App
                  {this.state.weatherData != null
                      ? &lt;Weather weatherData={this.state.weatherData}/&gt;
                      : &lt;p&gt;Loading...&lt;/p&gt;
                  }
  
              &lt;/div&gt;
          );
      }
  }
  
  module.exports = App;
  </code></pre>