Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

235
Views
How to remove white space to validate value using watch in react-hook-form

i would like to disable the continue button if values is empty, but with this if we enter space it is validating and enabling the button. i am also trimming the value.

 const disableContinue = () => {
    if (!watch('firstName') || !watch('lastName')) return true;
    if (!watch('nameChangeReason')) return true;
    if (watch('nameChangeReason') === 'Other') {
      if (!watch('nameChangeOtherReason')) return true;
    }
    return false;
  };

textField component

<TextField variant="outlined" inputRef={typeof register === 'function' ? register(name) : ref} required={required} value={typeof value === 'string' ? value?.trimStart() : value} name={name} />

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!