title: How to extract languages data nested in the api resonse using react
body: <p>I am tring to extract a piece of information that is nested in the api. However, when I do so, it gives me an error. I have already tried using the index for example {this.state.country.languages[0].iso639_1} etc... If anyone knows, please let me know. Thanks!</p>
  
  <pre><code>import React, { useState, useEffect } from "react";
  import CountryItem from "../components/CountryItem";
  import axios from "axios";
  
  
  class CountryPage extends React.Component{
  
      state = {
          country: []
      }
  
      componentDidMount() {
          axios.get(`https://restcountries.eu/rest/v2/name/${this.props.match.params.name}`)
              .then(response=&gt; {
                  this.setState({
                      country: response.data[0]
                  })
                  console.log(this.state.country)
              })
      }
      render() {
          return(
              &lt;div&gt;
                  &lt;h1&gt;Country: {this.props.match.params.name}&lt;/h1&gt;
                  &lt;div&gt;Native Name: {this.state.country.nativeName}&lt;/div&gt;
                  &lt;div&gt;Demograph: {this.state.country.demonym}&lt;/div&gt;
                  &lt;div&gt;Population: {this.state.country.population}&lt;/div&gt;
                  &lt;div&gt;Region: {this.state.country.region}&lt;/div&gt;
                  &lt;div&gt;Subregion: {this.state.country.subregion}&lt;/div&gt;
                  &lt;div&gt;Timezones: {this.state.country.timezones}&lt;/div&gt;
          &lt;div&gt;Langauges: {this.state.country.languages[0].iso639_1}&lt;/div&gt;
                  &lt;div&gt;Capitol: {this.state.country.capital}&lt;/div&gt;
                  &lt;div&gt;Calling Code: {this.state.country.callingCodes}&lt;/div&gt;
                  &lt;div&gt;Area :{this.state.country.area}&lt;/div&gt;
                  &lt;div&gt;Country Code: {this.state.country.alpha3Code}&lt;/div&gt;
              &lt;/div&gt;
          )
      }
  }
  
  export default CountryPage;
  
  
  
   [{"name":"China","topLevelDomain":[".cn"],"alpha2Code":"CN","alpha3Code":"CHN","callingCodes":["86"],"capital":"Beijing","altSpellings":["CN","Zhōngguó","Zhongguo","Zhonghua","People's Republic of China","中华人民共和国","Zhōnghuá Rénmín Gònghéguó"],"region":"Asia","subregion":"Eastern Asia","population":1377422166,"latlng":[35.0,105.0],"demonym":"Chinese","area":9640011.0,"gini":47.0,"timezones":["UTC+08:00"],"borders":["AFG","BTN","MMR","HKG","IND","KAZ","PRK","KGZ","LAO","MAC","MNG","PAK","RUS","TJK","VNM"],"nativeName":"中国","numericCode":"156","currencies":[{"code":"CNY","name":"Chinese yuan","symbol":"¥"}],"languages":[{"iso639_1":"zh","iso639_2":"zho","name":"Chinese","nativeName":"中文 (Zhōngwén)"}],"translations":{"de":"China","es":"China","fr":"Chine","ja":"中国","it":"Cina","br":"China","pt":"China","nl":"China","hr":"Kina","fa":"چین"},"flag":"https://restcountries.eu/data/chn.svg","regionalBlocs":[],"cioc":"CHN"},{"name":"Macao","topLevelDomain":[".mo"],"alpha2Code":"MO","alpha3Code":"MAC","callingCodes":["853"],"capital":"","altSpellings":["MO","澳门","Macao Special Administrative Region of the People's Republic of China","中華人民共和國澳門特別行政區","Região Administrativa Especial de Macau da República Popular da China"],"region":"Asia","subregion":"Eastern Asia","population":649100,"latlng":[22.16666666,113.55],"demonym":"Chinese","area":30.0,"gini":null,"timezones":["UTC+08:00"],"borders":["CHN"],"nativeName":"澳門","numericCode":"446","currencies":[{"code":"MOP","name":"Macanese pataca","symbol":"P"}],"languages":[{"iso639_1":"zh","iso639_2":"zho","name":"Chinese","nativeName":"中文 (Zhōngwén)"},{"iso639_1":"pt","iso639_2":"por","name":"Portuguese","nativeName":"Português"}],"translations":{"de":"Macao","es":"Macao","fr":"Macao","ja":"マカオ","it":"Macao","br":"Macau","pt":"Macau","nl":"Macao","hr":"Makao","fa":"مکائو"},"flag":"https://restcountries.eu/data/mac.svg","regionalBlocs":[],"cioc":""},{"name":"Taiwan","topLevelDomain":[".tw"],"alpha2Code":"TW","alpha3Code":"TWN","callingCodes":["886"],"capital":"Taipei","altSpellings":["TW","Táiwān","Republic of China","中華民國","Zhōnghuá Mínguó"],"region":"Asia","subregion":"Eastern Asia","population":23503349,"latlng":[23.5,121.0],"demonym":"Taiwanese","area":36193.0,"gini":null,"timezones":["UTC+08:00"],"borders":[],"nativeName":"臺灣","numericCode":"158","currencies":[{"code":"TWD","name":"New Taiwan dollar","symbol":"$"}],"languages":[{"iso639_1":"zh","iso639_2":"zho","name":"Chinese","nativeName":"中文 (Zhōngwén)"}],"translations":{"de":"Taiwan","es":"Taiwán","fr":"Taïwan","ja":"台湾（中華民国）","it":"Taiwan","br":"Taiwan","pt":"Taiwan","nl":"Taiwan","hr":"Tajvan","fa":"تایوان"},"flag":"https://restcountries.eu/data/twn.svg","regionalBlocs":[],"cioc":"TPE"}]
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/cGuqy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cGuqy.jpg" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/qdHbw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qdHbw.png" alt="enter image description here"></a></p>