title: How to stop onClick function midway?
body: <p>I scribbled this example to ask for solution. I give two functions to the link button. The first one is a conditional. If the condition is false, then everything's good and the second function can do its thing. But if the condition is met, then I want to stop the first and the second functions from happening. I am looking for a code that would stop the function from performing, event.StopPropagation did not work, are there other solutions?</p>
  
  <pre><code>function1 (e) {
          const dancers = this.state.dancers;
          if (array.length &lt; 16) {
              alert("Error"),
              e.StopPropagation?
          }
      }
  
  function2() {
  return function 
  }
  
  &lt;Link to={{ pathname: "/example" }} &gt;&lt;button className="create-button" onClick={(e) =&gt; { this.function1(e); this.function2();}}&gt;Go to example&lt;/button&gt;&lt;/Link&gt;
  </code></pre>