Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

164
Vistas
why the input value shows a type of string instead of type of number?

I am trying to get the input value type of number. But the value keep showing me its a type of string. How do i fix this?

const [price, setPrice] = useState();

const handlePrice = (event) => {
    console.log(event.target.value);
    setPrice(event.target.value);
};

        <div className="col-md-6">
          <label for="inputPrice" className="form-label">
            Price
          </label>
          <input
            value={price}
            onChange={handlePrice}
            type="number"
            className="form-control"
            id="inputPrice"
          />
        </div>
        <div className="col-12">
almost 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

const handlePrice = (event) => {
    console.log(event.target.value);
    // setPrice(parseInt(event.target.value));
    // setPrice(event.target.value * 1);
    setPrice(Number(event.target.value));
};
almost 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda