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

235
Vistas
Can't edit input value in React

I work on a project in React and I have an input in a table for quantity of a product I want to buy and I can't change the value on the web page.

If I delete value property, I can modify the value and I think I type something wrong. Cand somebody help me how to type that value property to be 1?

                       <input
                          type="text"
                          id={"cantitate_" + index}
                          value={1}
                          onChange={(e) => changeQuantity(e.target.value, index)}
                        />

changeQuantity is a function where I try to calculate something.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should be using defaultValue instead of value, since I assume from the comment that you are not implementing a controlled form:

  <input
    type="text"
    id={"cantitate_" + index}
    defaultValue={1}
    onChange={(e) => changeQuantity(e.target.value, index)}
  />
about 4 years ago · Juan Pablo Isaza 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