title: TypeError: Cannot read property 'message' of undefined ---using react-hook-form
body: <p>I am trying to display an error message when nothing is typed inside the message input form, but when I load the page I get this error 'TypeError: Cannot read property 'message' of undefined'. I am using react-hook-forms. This is my code down below.</p>
  <pre><code>import { Button } from &quot;@material-ui/core&quot;;
  import { Close } from &quot;@material-ui/icons&quot;;
  import React from &quot;react&quot;;
  import { useForm } from &quot;react-hook-form&quot;;
  import &quot;./SendMail.css&quot;;
  
  const SendMail = () =&gt; {
    const { register, handleSubmit, watch, errors } = useForm();
  
    const onSubmit = (formData) =&gt;{
      console.log(formData)
    }
  
  
    return (
      &lt;div className=&quot;sendMail&quot;&gt;
        &lt;div className=&quot;sendMail__header&quot;&gt;
          &lt;h3&gt;New Message&lt;/h3&gt;
          &lt;Close className=&quot;sendMail__close&quot; /&gt;
        &lt;/div&gt;
        &lt;form onSubmit={handleSubmit(onSubmit)}&gt;
          &lt;input name='to' placeholder=&quot;To&quot; type=&quot;text&quot; {...register('to',{required:true})}/&gt;
          
          &lt;input name=&quot;subject&quot; placeholder=&quot;Subject&quot; type=&quot;text&quot; {...register('subject',{required:true})} /&gt;
          
          &lt;input
            name=&quot;message&quot;
            placeholder=&quot;Message...&quot;
            type=&quot;text&quot;
            className=&quot;sendMail__message&quot;
            {...register('message',{required:true})}
          /&gt;
          {errors.message &amp;&amp; &lt;p&gt;To is required!!&lt;/p&gt;}
  
          &lt;div className=&quot;sendMail__send&quot;&gt;
            &lt;Button
              className=&quot;sendMail__send&quot;
              variant=&quot;contained&quot;
              color=&quot;primary&quot;
              type=&quot;submit&quot;
            &gt;
              Send
            &lt;/Button&gt;
          &lt;/div&gt;
        &lt;/form&gt;
      &lt;/div&gt;
    );
  };
  
  export default SendMail;
  </code></pre>