title: Only filter an array in JavaScript when a specific select option is selected
body: <p>I am trying to enable filtering within React on an array of JSON. I am sorting alphabetically, then I need to filter by category key IF the select dropdown is changed to that category (this is passed via the filter argument on the onChange event).</p>
  
  <p>Then I map over the filtered array, outputting the relevant HTML.</p>
  
  <p>My problem is, how do I essentially skip the filter, if the 'All' option is selected in the select dropdown?
  Currently when that is selected, no elements are passed to map and nothing is rendered out.</p>
  
  <p>Thanks :)</p>
  
  <pre><code>renderProduce(orderBy, filter) {
      return this.fetchProduce()
          .sort(function(a,b) {
              return (a.name &gt; b.name) ? 1 : ((b.name &gt; a.name) ? -1 : 0);
          })
          .filter(function(item) {
              if ( filter != 'All' ) {
                  return item.category == filter;
              }
          })
          .map((item, i) =&gt; (
              &lt;Item key={i} item={item} /&gt;
          ));
  }
  </code></pre>