title: How to send request on click React Hooks way?
body: <p>How to send http request on button click with react hooks? Or, for that matter, how to do any side effect on button click?</p>
  
  <p>What i see so far is to have something "indirect" like:</p>
  
  <pre><code>export default = () =&gt; {
    const [sendRequest, setSendRequest] = useState(false);
  
    useEffect(() =&gt; {
      if(sendRequest){
         //send the request
         setSendRequest(false);
      }
    },
    [sendRequest]);
  
    return (
      &lt;input type="button" disabled={sendRequest} onClick={() =&gt; setSendRequest(true)}
    );
  }
  </code></pre>
  
  <p>Is that the proper way or is there some other pattern?</p>