title: Calling a custom hook from an onClick by passing it arguments
body: <p>I created a custom hook to make my api calls with axios.
  When I call this hook passing it different parameters, it returns 3 states.</p>
  <p>I created a page with a form.
  When I submit this form I call a function &quot;onSubmitform&quot;
  I would like to be able to execute this custom hook in this function.</p>
  <p>How can I do ?</p>
  <p>Maybe a custom hook is not suitable in this case?</p>
  <pre><code>-- file useAxios.js --
  
  import { useState, useEffect } from &quot;react&quot;;
  import axios from &quot;axios&quot;;
  
  const useAxios = (axiosParams) =&gt; {
    const [response, setResponse] = useState(undefined);
    const [error, setError] = useState(&quot;&quot;);
    const [loading, setLoading] = useState(true);
  
    const handleData = async (params) =&gt; {
      try {
        const result = await axios.request(params);
        setResponse(result.data);
      } catch (error) {
        setError(error);
      } finally {
        setLoading(false);
      }
    };
  
    useEffect(() =&gt; {
      handleData(axiosParams);
    }, []);
  
    return { response, error, loading };
  };
  
  export default useAxios;
  
  </code></pre>
  <pre><code>-- file Page.js --
  
  import useAxios from &quot;../hooks/useAxios&quot;;
  
  function Page() {
    const { response } = useAxios();
  
    const onSubmitForm = () =&gt; {
      // Here I want to call the custom hook by passing it different parameters.
    }
  }
  
  </code></pre>