title: ReactJS comapre two objects inside componentdidupdate
body: <p>I am trying to add class based on previous props and currentprops in componentdid update.But its not giving an exact result as expected.Also showing syntax error.</p>
  
  <p>Below is my code</p>
  
  <pre><code>componentDidUpdate(prevProps, prevState){
          const prev = prevProps.marketcap.map( (coin, i) =&gt; (
              {
                  coin.DISPLAY.USD.PRICE &lt; this.props.marketcap[i].DISPLAY.USD.PRICE ? 'ups' : 'down'
              }
          ));
          console.log(prev); //it will return an object containing ups or down..
      }
  </code></pre>
  
  <p>above <code>marketcap</code> is a props</p>