title: How to loop through validation errors from server
body: <p>I am performing validation on the server with Node.js and sending the response back to the client</p>
  
  <pre><code>try {
    const response = await register(user);
    console.log(response);
  } catch (ex) {
    if (ex.response &amp;&amp; ex.response.status === 422) {
      const errors = ex.response.data.errors;
      this.setState({ errors });
    }
  }
  </code></pre>
  
  <p>If I console.log(this.state.errors) I get:</p>
  
  <pre><code>(5) [{…}, {…}, {…}, {…}, {…}]
  0: {name: "Name required"}
  1: {name: "Name should be more than 3 characters"}
  2: {email: "Invalid email address"}
  3: {password: "Password required"}
  4: {password: "Password should be at least 6 characters"}
  length: 5
  __proto__: Array(0)
  </code></pre>
  
  <p>I then want to just loop through all the errors and display them one underneath each other. </p>
  
  <pre><code>     {this.state.errors &amp;&amp;
          this.state.errors.map(error =&gt; &lt;li&gt;{error}&lt;/li&gt;)}
  </code></pre>
  
  <p>But I get an error that says:</p>
  
  <p>this.state.errors.map is not a function</p>