title: How to filter array of objects in react native?
body: <p>I want to filter this data array into state and city array. How can I achieve this using lodash or any other better way rather than for loop and maintaining extra arrays.</p>
  
  <pre><code>data: [
      { id: 1, name: Mike, city: philps, state: New York},
      { id: 2, name: Steve, city: Square, state: Chicago},
      { id: 3, name: Jhon, city: market, state: New York},
      { id: 4, name: philps, city: booket, state: Texas},
      { id: 5, name: smith, city: brookfield, state: Florida},
      { id: 6, name: Broom, city: old street, state: Florida},
  ]
  </code></pre>
  
  <p>which user click <code>state</code>, list of state appears.</p>
  
  <pre><code>{state: New York, count: 2},
  {state: Texas, count: 1},
  {state: Florida, count: 2},
  {state: Chicago, count: 1},
  </code></pre>
  
  <p>When user click particular state, list of <code>cities</code> of that state appears. For ex. when user clicks New York state,</p>
  
  <pre><code>{id:1, name: Mike, city: philps}
  {id:3, name: Jhon, city: market}
  </code></pre>