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

229
Views
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 answers
Answer question

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 Report
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!