title: In React, why does this onClick snippet of code work but not this other way ive tried to write it?
body: <p>Why does this work for the onClick</p>
  <pre><code>const mapDispatchToProps = (dispatch) =&gt; ({
    toggleCartHidden: () =&gt; dispatch(toggleCartHidden()),
  });
  
  &lt;Button
    onClick={() =&gt; {
      history.push('/checkout');
      toggleCartHidden();
    }}
  &gt;Button text&lt;/Button&gt;
  </code></pre>
  <p>But this doesnt work (the routing doesnt work)</p>
  <pre><code>&lt;Button
    onClick={
      (() =&gt; {
        history.push('/checkout');
      },
      toggleCartHidden)
    }
  &gt;Button text&lt;/Button&gt;
  </code></pre>
  <p>I have another component with similar code that works with this syntax with onClick (no function call within onClick)</p>
  <pre><code>const mapDispatchToProps = (dispatch) =&gt; ({
    toggleCartHidden: () =&gt; dispatch(toggleCartHidden()),
  });
  
  &lt;div className='cart-icon' onClick={toggleCartHidden}&gt; ICON &lt;/div&gt;
  </code></pre>