How does shallow compare work in react : <p>In <a href="https://facebook.github.io/react/docs/shallow-compare.html" rel="noreferrer">this documentation</a> of React, it is said that </p>

<blockquote>
  <p>shallowCompare performs a shallow equality check on the current props and nextProps objects as well as the current state and nextState objects.</p>
</blockquote>

<p>The thing which I am unable to understand is If It shallowly compares the objects then shouldComponentUpdate method will always return true, as</p>

<blockquote>
  <p>We should not mutate the states.</p>
</blockquote>

<p>and if we are not mutating the states then the comparison will always return false and so the shouldComponent update will always return true. I am confused about how it is working and how will we override this to boost the performance.</p>
