title: fetch data from api in Accordion list react native
body: <p>I want to fetch the title from </p>
  
  <blockquote>
    <p><a href="https://facebook.github.io/react-native/movies.json" rel="nofollow noreferrer">https://facebook.github.io/react-native/movies.json</a>
    in accordion view in react native 
    how can i do this </p>
  </blockquote>
  
  <p>here is my code but is display static data using array 
  now i want to display data from api </p>
  
  <pre><code>const dataArray = [
    {
      title: "First Element",
      content:""
  
    },
    {
      title: "Second Element",
      content:
        "content1"
    },
    {
      title: "Third Element",
      content:
        "content2"
    }
  ];
  
  class LocationScreen extends Component {
  
  
  
  componentDidMount(){
      return fetch('https://facebook.github.io/react-native/movies.json ')
        .then((response) =&gt; response.json())
        .then((responseJson) =&gt; {
  
          this.setState({
            isLoading: false,
            dataSource: responseJson.data,
          }, function(){
  
          });
            })
        .catch((error) =&gt;{
          console.error(error);
        });
    }
  
    render() {
      return (
        &lt;Container&gt;
                   &lt;Content padder&gt;
            &lt;Accordion
              dataArray={dataArray}
  
            /&gt;
          &lt;/Content&gt;
        &lt;/Container&gt;
      );
    }
  </code></pre>