title: FIlter and unfilter button in react native
body: <p>I'm trying to filter some data by their category id. Right now I can filter by category with value: 1. What I am trying to achieve is when the button is clicked again, it should clear the filter. Here is the code below:</p>
  <pre class="lang-js prettyprint-override"><code>const onPress = () =&gt; {
      const filteredResults = results.filter((result) =&gt;{
          return result.category === 1;
      });
      setResults(filteredResults);
  };
  </code></pre>
  <p>The button:</p>
  <pre class="lang-js prettyprint-override"><code>&lt;Button onPress={() =&gt;{onPress()}}&gt;Lajme&lt;/Button&gt;
  </code></pre>
  <p>How can I implement this function in the same button:</p>
  <pre class="lang-js prettyprint-override"><code>const clearFilter = () =&gt; {
      const filteredResults = results
      setResults(filteredResults);
  };
  </code></pre>