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

282
Views
How can I show a message if a condition isn't met in React

There is a form that uses Yup for data validation, for a field there are several conditions, it must be numerical value between 1 and 10, a default value 5, it must show an error message if the input is a number outside of the range and another error message if there is no input.

  const schema = yup.object({
      myInput: yup.number().default(5).min(1).max(10).required('no input'),
      ...
    });

It shows the default value, 5, but when it is deleted and clicked on submit there is no message saying 'no input'.

Also, where should be added the error message if the input is outside of [1, 10] interval?

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!