title: React JS parsing data in JSON
body: <p>I have facing an issue in React JS data parsing, i want to get <code>start_date</code> from JSON data</p>
  
  <p>My code</p>
  
  <pre><code>//fetch appointment data
    componentDidMount() {
      axios.get(`http://localhost/v1/appointments`)
      .then(res =&gt; {
        const appointmentdata = res.data;
        console.log(appointmentdata);          //result
        //this.setState({ appointmentdata: JSON.parse (appointmentdata.replace ("Array", ""))});
  
        this.setState({ appointmentdata });
      })
      }
  </code></pre>
  
  <p>react component: </p>
  
  <pre><code>&lt;div className="col-lg-3"&gt;
            {this.state.appointmentdata.map(data =&gt; &lt;p&gt;{data.start_date}&lt;/p&gt;) }
                      &lt;/div&gt;
  </code></pre>
  
  <p>just initialize the state with appointmentdata: [], so that on the first render it contains an empty array instead of undefined.</p>
  
  <p><strong>Error</strong>
  Unhandled Rejection (TypeError): this.state.appointmentdata.map is not a function</p>
  
  <p><strong>result</strong>   <code>console.log(appointmentdata)</code></p>
  
  <pre><code>&lt;div id="root" style="border: 1px solid red; padding : 25px; width: 800px;"&gt;This is 'root' div.&lt;/div&gt;
  --&gt;      
      [{"id":"1","start_date":"2020-05-09 15:30:00","end_date":"2020-05-09 16:00:00", "cust_email":"admin@gmail.com"},{"id":"2","start_date":"2020-05-09 00:00:00","end_date":"2020-05-09 00:30:00","cust_full_name":"mubeen","cust_email":""}]
  
  </code></pre>
  
  <p>How can i get value <code>start_date</code>.</p>
  
  <p>What should i do? Anyone help me?</p>
  
  <p><a href="https://i.stack.imgur.com/CDwO9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CDwO9.png" alt="enter image description here"></a></p>