title: How can I display this array on the page?
body: <p>I am trying to display an array of news articles on the page and getting an error:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Unhandled Rejection (TypeError): this.state.newsPost.map is not a function</code></pre>
  </div>
  </div>
  </p>
  <p>and this is my code that i am running:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { Component } from 'react'
  import { Container, Row, Col } from 'bootstrap-4-react';
  import News from '../Articles/News';
  import Post from '../Posts/Post/Post';
  import axios from 'axios';
  const REACT_APP_NEWS_ARTICLE_API = process.env.REACT_APP_NEWS_ARTICLE_API
  
  
  export default class Body extends Component {
    constructor(props){
      super(props)
  
      this.state = {
        posts: [{}],
        newsPost: [{}]
  
      }
    }
     
    componentDidMount = (props) =&gt; {
      axios.all([axios.get(`${process.env.REACT_APP_SERVER_URL}/posts`), 
      axios.get(`https://newsapi.org/v2/top-headlines?sources=techcrunch&amp;apiKey=${REACT_APP_NEWS_ARTICLE_API}`)])
        .then(axios.spread((...responses) =&gt; {
          const responseOne = responses[0]
          const responseTwo = responses[1]
  
          this.setState({
            posts: responseOne.data,
            newsPost: responseTwo.data
          })
        }
        
        ))
  
    };
  
    render() {
      console.log(this.state.newsPost) //returns an array of articles
  
      return (
        &lt;Container id="bodycontainer" className="container"&gt;
          &lt;Row className="technews"&gt;
          // This is the loop that's returning the error
          {this.state.newsPost.map((item) =&gt; {
            &lt;div key={item.id} className="technewsitem"&gt;
              {item}
            &lt;/div&gt;
          })}
          &lt;/Row&gt;
        &lt;/Container&gt;
      )
    }
  }</code></pre>
  </div>
  </div>
  </p>
  <p>How can I run the code in order to display the array on the page, any pointers is greatly appreciated.</p>