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

173
Views
Cómo una lista de menú desplegable

Estoy tratando de hacer un menú desplegable en javascript donde obtener todos los estados de una función y mostrarlos en el menú desplegable. Pero el código que tengo hasta ahora muestra mal mi lista. Cada estado está uno al lado del otro en lugar de dentro del menú desplegable.

menú.js

 export default function DropDownMenu(props){ if(!props.states) return return( <table> <body> {props.states.map(states=> <select> <option>{states.state}</option> </select>)} </body> </table> ) }

Lo que está mostrando:

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

El problema es que está envolviendo el elemento select dentro del mapa, intente hacer lo siguiente:

 export default function DropDownMenu(props){ if(!props.states) return return( <table> <body> // to select the value from option, just add the onChange listener <select onChange={(e) => { console.log(e.target.value) }}> {props.states.map(states=> <option>{states.state}</option> )} </select> </body> </table> ) }

De esa manera, simplemente renderizará dinámicamente el elemento de opción.

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!