title: Record a changing input field in react-hook-form?
body: <p>I'm trying to record values from a form using react-hook-form. All other situations are working, however I am getting a return value of 'undefined' when I attempt to retrieve data from a value that is also a react hook (<code>useState</code>).</p>
  <pre><code>const [quantity, setQuantity] = useState(1);
  
  const increaseQuantity = () =&gt; {
    setQuantity((prevQuantity) =&gt; prevQuantity + 1);
  };
  
  const decreaseQuantity = () =&gt; {
    if (quantity &gt; 1) {
      setQuantity((prevQuantity) =&gt; prevQuantity - 1);
    }
  };
  
  const { register, handleSubmit } = useForm();
  const onSubmit = (data) =&gt; {
    console.log(data);
  };
  </code></pre>
  <pre><code>&lt;DescriptionButtonsWrapper&gt;
    &lt;CounterContainer&gt;
      &lt;CounterWrapper&gt;
        &lt;CounterButtons onClick={decreaseQuantity}&gt;-&lt;/CounterButtons&gt;
      &lt;/CounterWrapper&gt;
      &lt;CounterWrapper&gt;
        &lt;CounterInput
          {...register(&quot;quantity&quot;)}
          placeholder=&quot;Quantity&quot;
          id=&quot;quantity&quot;
          type=&quot;number&quot;
        &gt;
          {quantity}
        &lt;/CounterInput&gt;
      &lt;/CounterWrapper&gt;
      &lt;CounterWrapper&gt;
        &lt;CounterButtons onClick={increaseQuantity}&gt;+&lt;/CounterButtons&gt;
      &lt;/CounterWrapper&gt;
    &lt;/CounterContainer&gt;
  &lt;/DescriptionButtonsWrapper&gt;
  &lt;DescriptionButtonsWrapper&gt;
    &lt;Btn onClick={handleSubmit(onSubmit)}&gt;Add to Cart&lt;/Btn&gt;
  &lt;/DescriptionButtonsWrapper&gt;
  </code></pre>