title: simplify onPress through currying?
body: <p>I was testing out how to combine 2 very similar functions into one to reduce my code base and was wondering if ti can be done through currying. It is a new concept to me, so I have failed and now am asking for help.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const yesNoEnum = {
    none: null,
    no: 0,
    yes: 1,
  };  
  
    noButtonOnPress = () =&gt; {
      const isSelected = this.state.selected === yesNoEnum.no;
  
      if (isSelected) {
        this.setState({
          selected: yesNoEnum.none,
        });
        return;
      }
  
      this.setState({
        selected: yesNoEnum.no,
      });
    }
  
    yesButtonOnPress = () =&gt; {
      const isSelected = this.state.selected === yesNoEnum.yes;
  
      if (isSelected) {
        this.setState({
          selected: yesNoEnum.none,
        });
        return;
      }
  
      this.setState({
        selected: yesNoEnum.yes,
      });
    }
    
      isSelected = () =&gt; {
      const selected = {
        no: this.state.selected === yesNoEnum.no,
        yes: this.state.selected === yesNoEnum.yes,
      };</code></pre>
  </div>
  </div>
  </p>
  
  <p>I was wondering if the noButton and yesButton clicks could be combined. This is what I attempted before:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>  handleButtonPress = (shouldCheckYes) = () =&gt; {
      const isSelected = this.state.selected === shouldCheckYes ? yesNoEnum.yes : yesNoEnum.no;
  
      if (isSelected) {
        this.setState({
          selected: yesNoEnum.none,
        });
        return;
      }
  
      this.setState({
        selected: shouldCheckYes ? yesNoEnum.yes : yesNoEnum.no,
      });
    }</code></pre>
  </div>
  </div>
  </p>