title: How to sort array of objects based on descending order of date in reactjs?
body: <p>I have an array of objects as below and want to sort it in descending order.</p>
  
  <p>Below is the array of objects </p>
  
  <pre><code>[
  {
      "attributes": {
  
      },
      "timestamp": "2019-04-03T21:00:00+00:00",
  },
  {
      "attributes": {
      },
      "timestamp": "2019-04-03T09:24:27.179190+00:00",
  },
  {
      "attributes": {
      },
      "timestamp": "2019-04-03T08:54:06.721557+00:00",
  },
  {
      "attributes": {
  
      },
      "timestamp": "2019-04-03T04:54:56.227415+00:00",
  },
  ]
  </code></pre>
  
  <p>What I have tried?</p>
  
  <pre><code> let sorted_array = this.state.array.sort((a, b) =&gt; a.timestamp - 
       b.timestamp);
   this.setState({array: sorted_array});
  </code></pre>
  
  <p>But this doesnt work.
  Could you someone help me with this?</p>