title: useForm() is not updating after fetching data using useEffect() - Next.js
body: <p>The form is not getting updated after fetching data from the database using useEffect.</p>
  <p><strong>useEffect</strong></p>
  <pre><code>useEffect(() =&gt; {
      async function fetchData() {
  
        const res = await fetch(process.env.NEXT_PUBLIC_API + `/resume/${user?.sub?.split('|')[1]}`);
        const data = await res.json();
  
        updateResume(data?.resume || {});
      }
      fetchData();
    }, []);
  </code></pre>
  <p><strong>useState</strong></p>
  <pre><code>const [storedResume, updateResume] = useState({} as any);
  </code></pre>
  <p><strong>useForm</strong></p>
  <pre><code>const { register, handleSubmit, watch, formState: { errors } } = useForm&lt;any&gt;({
      resolver: yupResolver(schema),
      defaultValues: storedResume || {},
    });
  </code></pre>
  <p>I have also tried changing storedResume to variable and useRef too. Not working.</p>
  <p>Also, I can see the data in console.log()</p>
  <p>I cannot use getStaticProps from Next.js since I need userId to pass in fetch URL.</p>
  <p><a href="https://github.com/Aravin/Resume-Vita/blob/main/Code/client/components/resume/Form.tsx" rel="nofollow noreferrer">Full Source Code </a></p>
  <p>Data from DB</p>
  <pre><code>{&quot;_id&quot;:&quot;6167140a042e6430dd849603&quot;,&quot;user&quot;:&quot;104494318779322042776&quot;,&quot;resume&quot;:{&quot;personal&quot;:{&quot;firstName&quot;:&quot;Aravind&quot;,&quot;lastName&quot;:&quot;Appadurai&quot;,&quot;email&quot;:&quot;aravin.it@gmail.com&quot;,&quot;phone&quot;:&quot;9710549943&quot;,&quot;summary&quot;:&quot;To gain a dynamic and challenging role in Information Technology, that will offer me the best opportunity for the further development of abilities, skills, and knowledge in a well-established firm with long term career growth possibilities.&quot;},&quot;education&quot;:[{&quot;institution&quot;:&quot;Bhajarang Engg College&quot;,&quot;subject&quot;:&quot;B. Tech (Information Technology)&quot;,&quot;startDate&quot;:&quot;2010-04&quot;,&quot;endDate&quot;:&quot;2014-04&quot;,&quot;score&quot;:7.5,&quot;location&quot;:&quot;Chennai&quot;,&quot;index&quot;:0},{&quot;institution&quot;:&quot;Salvation Matriculation School&quot;,&quot;subject&quot;:&quot;HSC (12th)&quot;,&quot;startDate&quot;:&quot;2009-04&quot;,&quot;endDate&quot;:&quot;2010-04&quot;,&quot;score&quot;:6.5,&quot;location&quot;:&quot;&quot;,&quot;index&quot;:1}],&quot;employment&quot;:[{&quot;title&quot;:&quot;Senior Software Engineer II&quot;,&quot;company&quot;:&quot;Everi Fintech&quot;,&quot;startDate&quot;:&quot;2018-08&quot;,&quot;endDate&quot;:&quot;&quot;,&quot;location&quot;:&quot;Chennai&quot;,&quot;isCurrent&quot;:true,&quot;summary&quot;:&quot;Leading and Co-ordinating the team and completing the project/features/work item on the time. Supporting the peer for their queries and issues. Attending the meeting with management and consolidating the requirements. Supporting for Production issues.&quot;,&quot;index&quot;:0},{&quot;title&quot;:&quot;Senior Engineer&quot;,&quot;company&quot;:&quot;CSS Corp&quot;,&quot;startDate&quot;:&quot;2017-02&quot;,&quot;endDate&quot;:&quot;2021-07&quot;,&quot;location&quot;:&quot;Chennai&quot;,&quot;isCurrent&quot;:false,&quot;summary&quot;:&quot;Maintaining and Feature enhancement for existing web application using ASP.NET MVC, C#, Oracle Databases, Web/Windows Service, ADS server and Angular.\n&quot;,&quot;index&quot;:1}],&quot;skills&quot;:[{&quot;name&quot;:&quot;Node.js&quot;,&quot;level&quot;:3,&quot;index&quot;:0},{&quot;name&quot;:&quot;JavaScript&quot;,&quot;level&quot;:3,&quot;index&quot;:1},{&quot;name&quot;:&quot;TypeScript&quot;,&quot;level&quot;:3,&quot;index&quot;:2},{&quot;name&quot;:&quot;React.js&quot;,&quot;level&quot;:2,&quot;index&quot;:3},{&quot;name&quot;:&quot;Next.js&quot;,&quot;level&quot;:3,&quot;index&quot;:4},{&quot;name&quot;:&quot;Express.js&quot;,&quot;level&quot;:4,&quot;index&quot;:5},{&quot;name&quot;:&quot;Angular.js&quot;,&quot;level&quot;:2,&quot;index&quot;:6}],&quot;language&quot;:[{&quot;name&quot;:&quot;Tamil&quot;,&quot;level&quot;:3,&quot;index&quot;:0},{&quot;name&quot;:&quot;English&quot;,&quot;level&quot;:3,&quot;index&quot;:1}],&quot;links&quot;:[{&quot;label&quot;:&quot;Blog&quot;,&quot;link&quot;:&quot;https://www.aravin.net&quot;,&quot;index&quot;:0},{&quot;label&quot;:&quot;GitHub&quot;,&quot;link&quot;:&quot;https://www.github.com/aravin&quot;,&quot;index&quot;:1}],&quot;course&quot;:[{&quot;name&quot;:&quot;70-483 - Programming in C# (MCP)&quot;,&quot;institution&quot;:&quot;Microsoft&quot;,&quot;startDate&quot;:&quot;&quot;,&quot;endDate&quot;:&quot;&quot;,&quot;email&quot;:&quot;friend@google.com&quot;,&quot;phone&quot;:&quot;9710549943&quot;,&quot;index&quot;:0}],&quot;reference&quot;:[{&quot;name&quot;:&quot;Friend Name&quot;,&quot;company&quot;:&quot;Google&quot;,&quot;email&quot;:&quot;aravin.it@gmail.com&quot;,&quot;phone&quot;:&quot;9710549943&quot;,&quot;index&quot;:0}]}}
  </code></pre>