title: Sorting array of objects in Redux reducer
body: <p>I am trying to sort an array like this (my state):</p>
  <pre class="lang-js prettyprint-override"><code>[
    {
      name:&quot;Aenean in justo ante&quot;
    },
    {
      name:&quot;Phasellus viverra mattis dolor&quot;
    }
  ]
  </code></pre>
  <p>I dispatch an action to the reducer: (part of reducer)</p>
  <pre class="lang-js prettyprint-override"><code>case 'SORT_COLLECTION':
    return state.sort(function(a, b) {
      var nameA = a.name.toLowerCase(), nameB = b.name.toLowerCase();
      if (nameA &lt; nameB) {
        return -1;
      }
      if (nameA &gt; nameB) {
        return 1;
      }
      return 0;
    })
  </code></pre>
  <p>but it does not work.
  Could somebody tell me where the mistake is?</p>