title: Unable to use react form data in useEffect hook
body: <p>I have an <strong>antd form</strong> where I am able to get the form data in <code>onFinish function</code> upon hitting submit button in which I wanted to use <code>uesEffect hook</code> and dispatch an action with form data as payload to redux saga but I got following error</p>
  <pre><code>React Hook &quot;useEffect&quot; is called in function &quot;onFinish&quot; that is neither a React function component nor a custom React Hook function.
  </code></pre>
  <p><strong>If I write useEffect hook outside the <code>onFinsh</code> function, I am unable to get the form data/values</strong></p>
  <hr />
  <p><strong>Please suggest a workaround to get the form data values outside of    onFinish function</strong></p>
  <hr />
  <pre><code>import React, { useState, useEffect } from 'react';
  import ReactDOM from 'react-dom';
  import 'antd/dist/antd.css';
  import './index.css';
  import { Form, Input, Button, Checkbox } from 'antd';
   
  
  const Demo = () =&gt; {
    const onFinish = (values) =&gt; {
      // alert(JSON.stringify(values['username']));
      useEffect(() =&gt; {
        // dispatch an action with values as payload
       }, []);
    };
  console.log(values) // UNABLE TO GET VALUES HERE...HOW TO GET IT???
    return (
      &lt;Form
        name=&quot;basic&quot;
        onFinish={onFinish}&gt;
        &lt;Form.Item
          label=&quot;Username&quot;
          name=&quot;username&quot;&gt;
          &lt;Input /&gt;
        &lt;/Form.Item&gt;
        &lt;Form.Item&gt;
          &lt;Button type=&quot;primary&quot; htmlType=&quot;submit&quot;&gt;
            Submit
          &lt;/Button&gt;
        &lt;/Form.Item&gt;
      &lt;/Form&gt;
    );
  };
  
  ReactDOM.render(&lt;Demo /&gt;, document.getElementById('container'));
  </code></pre>