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

156
Views
¿Cómo usar correctamente NumberFormat para guiar el cursor y la separación de números fraccionarios?

Estoy usando la función como esta:

 const handleOnChangeSpread = useCallback((spread) => {
 const NEW_SPREAD_VALUE = new Intl.NumberFormat('pt-BR', {
 useGrouping: true,
 minimumFractionDigits: 2,
 maximumFractionDigits: 2
 }).format(spread).replace(",", ".");

 setSpread(NEW_SPREAD_VALUE);
 }, []);

 <input
 onChange={({ target: { value }}) => handleOnChangeSpread(value)}
 type="number"
 min={0}
 max={20}
 maxlength={5}
 value={spread}
 />

Sin embargo, no proporciona una buena experiencia de usuario por las siguientes razones:

  1. El cursor "|" siempre va al último carácter;
  2. No es posible utilizar la tecla de borrar/retroceso;
  3. El usuario siempre tiene que llevar el cursor al lugar decimal que quiere cambiar;

¿Cómo hago para que sea una experiencia "fluida", donde es posible cambiar fácilmente los valores y eliminarlos para el usuario?

almost 4 years ago · Santiago Trujillo
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!