title: How to update default value as updated data using react hook form in Mongo DB
body: <p>I try to update the values of a form, for this, I use a react hook form. When it is rendered first it shows the default value which was given previously. It works fine whenever I tried to change all the values. But when I only change a specific field it removes all other value from the element, and only update this field.
  <a href="https://i.stack.imgur.com/u2i5n.png" rel="nofollow noreferrer">enter image description here</a>
  I want to update only specific fields without changing the previous value How can I do that?</p>
  <pre class="lang-js prettyprint-override"><code>const onSubmit = (data) =&gt; {
    axios.put(`http://localhost:4000/users/${id}`, data)
         .then(res =&gt; console.log(&quot;success&quot;))
  }
  
  return (
    &lt;div&gt;
      &lt;form onSubmit={handleSubmit(onSubmit)}&gt;
        &lt;label&gt;Team 1&lt;/label&gt;
        &lt;input defaultValue={match.team1} {...register(&quot;team1&quot;)} /&gt; &lt;br /&gt;
        &lt;label&gt;Team 2&lt;/label&gt;
        &lt;input defaultValue={match.team2} {...register(&quot;team2&quot;)} /&gt;&lt;br /&gt;
        &lt;input type=&quot;submit&quot; /&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  );
  </code></pre>