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

172
Views
cómo obtener el valor de dos etiquetas p en reaccionar usando useState en ReactJs

Estoy tratando de obtener el valor de dos etiquetas p al mismo tiempo para enviar esos valores al backend.

mi declaración useState const [isOffer, setIsOffer] = useState({ contractorName: "", newOffer: "" });

 const handleChange = (e) => { const { name, value } = e.target;` setIsOffer({ ...isOffer, [name]: value, }); };

cómo manejo el envío del formulario

 const handleFormSubmit = async (event) => { event.preventDefault(); try { await approveOffer({ variables: {isOffer, projectId }, }); } catch (err) { console.log(err); } }; <form className="flex-row justify-center justify-space-between-md align-stretch" onSubmit={handleFormSubmit}> <p className="card-body" name="contractorName" value={offer.ContractorName} onClick={handleChange} > Offer By:{offer.ContractorName} </p> <p name="newOffer" value={offer.newOffer} onClick={handleChange} > The Offer Value:{offer.newOffer}{" "} </p> <button className="btn d-block w-100" type="submit"> </form>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

reemplazará el código handleChange con el siguiente código:

Existente:

 const { name, value } = e.target;

Reemplazar:

 const name = e.target.getAttribute('name'); const value = e.target.getAttribute('value');
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!