title: ReactJS: onClick function executes before clicking button
body: <p>The function <code>SendCred()</code> executes the page is loading, but I want this to be called when the user clicks the <code>&lt;button&gt;</code>. What should I do?</p>
  
  <pre><code> import React,{useState} from "react";
  
      export default function Signup(props){
  
        const sendCred=()=&gt;{
          console.log("test")
        };
  
  
        return (
          &lt;div className="row container"&gt;
            &lt;button onClick={sendCred()}&gt; Activate Laser &lt;/button&gt;
          &lt;/div&gt;
        );
  
      };
  </code></pre>