title: how to clear errors in react hook form
body: <p>I have a useEffect to check whether the image Im trying to upload is the right type. when I do not upload the right type I am setting the errors.message= invalid. But then I re render the page but my error is still there. I am trying to clear the error object in react hook form. How can I make this to work</p>
  <pre><code>const imgField = watch(field)
  
  useEffect(() =&gt; {
          if (imgField) {
              if (
                  !['image/jpeg', 'image/png', 'image/gif', 'image/jpg'].includes(
                      imgField.type
                  )
              ) {
                  errors.message = 'not an image';
              } else {
                      clearErrors()
              }
          }
      }, [imgField, errors]);
  </code></pre>