title: Getting empty data object from my form react-hook-form
body: <p>Form is <strong>returning empty data object</strong>, but it should return values typed in form.
  onSubmit function should console.log values given in form, but I don't know why it does not working.
  Please check it out.</p>
  <pre><code>function App() {
      const { register, handleSubmit } = useForm();
      const onSubmit = (data, e) =&gt; {
          e.preventDefault();
          console.log(data);
          console.log('sent');
      };
      const onError = (errors, e) =&gt; console.log(errors, e);
  
      return (
          &lt;div className=&quot;App&quot;&gt;
              &lt;header className=&quot;App-header&quot;&gt;
                  &lt;form onSubmit={handleSubmit(onSubmit, onError)}&gt;
                      &lt;input
                          name=&quot;email&quot;
                          autoComplete=&quot;off&quot;
                          placeholder=&quot;Your email&quot;
                          ref={register({ name: &quot;email&quot; }, { required: true, pattern: /^\S+@\S+$/i })}
                          
                      /&gt;
                      &lt;select
                          defaultValue=&quot;default&quot;
                          name=&quot;select1&quot;
                          ref={register({ name: &quot;select1&quot; }, { required: true })}
                      &gt;
                          &lt;option value=&quot;default&quot; disabled&gt;default&lt;/option&gt;
                          &lt;option value=&quot;A&quot;&gt;A&lt;/option&gt;
                          &lt;option value=&quot;B&quot;&gt;B&lt;/option&gt;
                      &lt;/select&gt;
                      &lt;textarea
                          name=&quot;message&quot;
                          placeholder=&quot;Your message&quot;
                          ref={register({ name: &quot;message&quot; }, { required: true })}
                      /&gt;
                      &lt;button type=&quot;submit&quot;&gt;Send&lt;/button&gt;
                  &lt;/form&gt;
              &lt;/header&gt;
          &lt;/div&gt;
      );
  }
  </code></pre>