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

230
Views
¿Cómo puedo cambiar este componente de clase a un componente funcional? Por favor, no regañes;)

Estoy tratando de convertir todos los componentes de mi clase en componentes funcionales. ¿Cómo puedo convertir este componente de clase en un componente funcional? Cómo ve este código utilizado para la validación y debo convertir todas las clases y el código estático en funcional, por favor ayúdenme

 const regex = { email: new RegExp( '^(([^<>()\\[\\]\\\\.,;:\\s@]+(\\.[^<>()\\[\\]\\\\.,;:\\s@]+)*)|(.+))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$', ), number: new RegExp('^[0-9]+$'), }; export class Validators { static email(value, message) { if (value) { const result = regex.email.test(value); if (!result) return { error: true, message }; } return false; } static required(value, message) { if (!value || !value.toString().trim().length) { return { error: true, message }; } return false; } static number(value, message) { const length = value ? value.toString().length : 0; if (length > 0) { const result = regex.number.test(value); if (!result) { return { error: true, message }; } } return false; } } export const validateInput = (validators, value) => { if (validators && validators.length) { for (let i = 0; i < validators.length; i++) { const error = validators[i].check(value, validators[i].message); if (error) { return error; } } } return false; };
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!