title: Openweather API JSON data
body: <p>I am having issues with JSON data received from openweathermap. Probably I don't see an array or something but I need help. </p>
  
  <pre><code>import React, { Component } from 'react';
  import { connect } from 'react-redux';
  
  class Weather extends Component {
  
  render() {
      const weatherData = this.props.weather;
      console.log(weatherData);
      return (
          &lt;div&gt;
              &lt;div&gt;{weatherData.name}&lt;/div&gt;
              &lt;div&gt;Temperature: {weatherData.main.temp}&lt;/div&gt;
          &lt;/div&gt;
      );
  }
  }
  
  const mapStateToProps = (state) =&gt; {
      return {
          weather: state.weather
      };
  };
  export default connect(mapStateToProps)(Weather);
  </code></pre>
  
  <p>Error in console:</p>
  
  <pre><code>TypeError: Cannot read property 'temp' of undefined
  </code></pre>
  
  <p>And this object received from openweathermap API</p>
  
  <pre><code>    {
    "coord": {
      "lon": -0.13,
      "lat": 51.51
    },
    "weather": [
      {
        "id": 800,
        "main": "Clear",
        "description": "clear sky",
        "icon": "01n"
      }
    ],
    "base": "stations",
    "main": {
      "temp": 282.96,
      "pressure": 1030,
      "humidity": 71,
      "temp_min": 280.15,
      "temp_max": 286.15
    },
    "visibility": 10000,
    "wind": {
      "speed": 3.1,
      "deg": 70
    },
    "clouds": {
      "all": 0
    },
    "dt": 1551209222,
    "sys": {
      "type": 1,
      "id": 1414,
      "message": 0.0082,
      "country": "GB",
      "sunrise": 1551163869,
      "sunset": 1551202579
    },
    "id": 2643743,
    "name": "London",
    "cod": 200
  }
  </code></pre>
  
  <p>For example, I am getting weatherData.name without any problems but weatherData.main.temp is causing an error</p>
  
  <p>console.log(weatherData)
  <a href="https://i.stack.imgur.com/kFDmI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kFDmI.png" alt="console.log(weatherData)"></a></p>