title: how to group array of objects by value in reactjs
body: <p>Considering the <code>array</code></p>
  <pre><code>const a1 = [
    { id: 1, nome: 'Ruan', status: { id: 1, posicao: 'goleiro' } },
    { id: 2, nome: 'Gleison', status: { id: 2, posicao: 'zagueiro' } },
    { id: 3, nome: 'Geraldo', status: { id: 2, posicao: 'zagueiro' } },
    { id: 4, nome: 'Heleno', status: { id: 3, posicao: 'atacante' } },
    { id: 5, nome: 'Djandel', status: { id: 3, posicao: 'atacante' } }
  ]
  </code></pre>
  <p>I've tried using <code>reduce</code>, but without success, I tried the code below</p>
  <pre><code>var groupBy = function(xs, key) {
    return xs.reduce(function(rv, x) {
      (rv[x[key]] = rv[x[key]] || []).push(x);
      return rv;
    }, {});
    groupBy(a1, 'status')
  };
  </code></pre>
  <p>I also tried with <code>lodash</code></p>
  <pre><code>_.groupBy(a1, 'status');
  </code></pre>
  <p>I hope that 3 different <code>arrays</code> will return, one with the <code>goleiros</code>, another with the <code>zagueiros</code> and another with the <code>atacantes</code></p>
  <p>And how to display the information separately in the <code>react</code> view?</p>