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

152
Views
Pasar valores múltiples en la opción Seleccionar en React

Tengo problemas para pasar dos valores en mi componente de selección y trabajar en React. Actualmente estoy pasando el valor de id correcto en las opciones seleccionadas... sin embargo, cuando paso al cuerpo en newCapabilities, recibe el valor de id (agent.agentId) en lugar del valor de nombre previsto (agent.agent). Necesito poder enviar tanto el valor de identificación como el valor de nombre que estoy asignando en el agente.

¿Qué estoy haciendo mal aquí?

reaccionar-componente.js

 const handleChangeForm = (e) => { const { id, value } = e.target setForm({ ...form, [id]: value }) } const addCapabilities = async (tableName, body) => { const newCapabilities = { agent } response(newCapabilities) } <form> <label>Agent</label> <select className='add-cap-select' id='agent' onChange={handleChangeForm}> <option value=''>Agent</option> {agents.map((agent, index) => ( <option key={index} value={agent.agentId}> {agent.agent} </option> ))} </select> </form>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede encontrar el agente seleccionado y obtener el valor del nombre

 const newCapabilities = { agent: agents.find(a => a.agentId == form.agent)?.agent }
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!