title: Call Open Weather API with React Native
body: <p>I am experimenting with Open Weather. I trying to replace the innerHTML of a Text element with the temperature number. If I alert the const temperature I get undefined....</p>
  
  <pre><code>import React, { Component } from 'react';
  import { StyleSheet, Button, Alert, Text, View, ImageBackground, TextInput} from 'react-native';
  const openweather_api = "https://api.openweathermap.org/data/2.5/weather?q=V&amp;appid=somenumberss&amp;units=metric";
  
  export default class App extends Component {
    state = {};
  
    componentDidMount(){
      async function getWeather() {
        try {
          const response = await fetch(openweather_api);  
          const json = await response.json();
          console.log(json) // works, it returns the weather data..
          alert(json.main.temp) // works, it returns 2 degrees. 
          this.setState({
            temperature: json.main.temp,
            humidity: json.main.humidity,
          });
          } catch (e) {
          alert('something went wrong')
          }
        }
      getWeather();
    }
  
    render() {
  alert(json.main.temp) // gets undefined.. 
  console.log(this.state) // returns {} __proto__.....
  
    return (
    &lt;View style={styles.container}&gt;
       &lt;Text&gt;Today's temperature is {this.state.temperature} Celcius&lt;/Text&gt;
      &lt;Text&gt;{this.state.humidity &gt; 100 &amp;&amp; this.state.temperature &gt; 20 ? 'nice weather' : 'bad weather'}&lt;/Text&gt;
      &lt;/View&gt;
    );
  }
  
  }
  </code></pre>