title: Trying to call function onClick inside Chakra UI Modal won't work
body: <p>I have a function to do some calculations called 'handleEstimate' I want the function to run on button click inside a ChakraUI modal. But when I click the button inside the modal the function will not run. I tried the same thing inside outside the modal component and it works. I also tried defining the function inside the modal component, that didn't work.</p>
  <p>handleEstimate function</p>
  <pre><code> async function handleEstimate() {
      register({ name: &quot;estimatedPayment&quot;, type: &quot;custom&quot; });
      setValue(&quot;estimatedPayment&quot;, calcData
      .filter( (term) =&gt; term.newOrUsed === state.data.carStatus &amp;&amp; term.year === state.data.modelYear )
      .map((filteredTerm) =&gt; (Math.round(
      
      ((state.data.price - state.data.price * (filteredTerm.deposit / 100)) *
        
        (filteredTerm.rate / 100 / 12) *
        
        Math.pow( 1 + filteredTerm.rate / 100 / 12, filteredTerm.term  )) /
        
        (Math.pow( 1 + filteredTerm.rate / 100 / 12,  filteredTerm.term) - 1)
      ))));
      register({ name: &quot;calcTerm&quot;, type: &quot;custom&quot; });
      setValue(&quot;calcTerm&quot;, calcData
      .filter(
        (term) =&gt;
          term.newOrUsed === state.data.carStatus &amp;&amp;
          term.year === state.data.modelYear
      )
      .map((filteredTerm) =&gt; filteredTerm.term *12 - 0));
      register({ name: &quot;calcRate&quot;, type: &quot;custom&quot; });
      setValue(&quot;calcRate&quot;, calcData
      .filter(
        (term) =&gt;
          term.newOrUsed === state.data.carStatus &amp;&amp;
          term.year === state.data.modelYear
      )
      .map((filteredTerm) =&gt; filteredTerm.rate - 0));
      register({ name: &quot;calcDeposit&quot;, type: &quot;custom&quot; });
      setValue(&quot;calcDeposit&quot;, calcData
      .filter(
        (term) =&gt;
          term.newOrUsed === state.data.carStatus &amp;&amp;
          term.year === state.data.modelYear
      )
      .map((filteredTerm) =&gt; filteredTerm.deposit - 0));
    }
  </code></pre>
  <p>ChakraUI Modal Component</p>
  <pre><code>  function BasicUsage() {
  
  
          return (
        &lt;&gt;
          &lt;Button colorScheme='e65323' className=&quot;centered-button&quot; onClick={onOpen}&gt;Save &amp; 
                Continue&lt;/Button&gt;
          &lt;Modal isOpen={isOpen} onClose={onClose}&gt;
            &lt;ModalOverlay /&gt;
            &lt;ModalContent&gt;
              &lt;ModalHeader&gt;Request For Personal Details&lt;/ModalHeader&gt;
              &lt;ModalCloseButton /&gt;
              &lt;ModalBody&gt;
              Note: 
              
              We will now ask you for some personal details in order to better match you with the right Banks.
              
              Your information is safe. If you do not complete your request for us to send your information to Banks within 7 days, we will permanently delete your information.
  
              &lt;/ModalBody&gt;
    
              &lt;ModalFooter&gt;
                
                &lt;Button  onClick={handleEstimate} colorScheme='blue' mr={3}&gt;
                 Continue
                &lt;/Button&gt;
  
                &lt;Button onClick={onClose} variant='ghost'&gt;Save &amp; Exit&lt;/Button&gt;
  
              &lt;/ModalFooter&gt;
            &lt;/ModalContent&gt;
          &lt;/Modal&gt;
        &lt;/&gt;
      )
    }
  </code></pre>
  <p>I then use the modal component on the page:</p>
  <pre><code> &lt;BasicUsage&gt;&lt;/BasicUsage&gt;
            
       &lt;button  onClick={handleEstimate} className=&quot;centered-button&quot;&gt;
               
              &lt;/button&gt;
  </code></pre>
  <p>The HTML button element successfully calls the function but when I open the modal and click the:</p>
  <pre><code>&lt;Button onClick={handleEstimate} colorScheme='blue' mr={3}&gt;
                 Continue
                &lt;/Button&gt;
  </code></pre>
  <p>The function is not called</p>