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

85
Vistas
Display items from JSON server response

I have this JSON returned from the server:

[
   {
      "symbol":"one option"
   },
   {
      "symbol":"second option"
   }
   .......
]

I tried to display the data into dropdown using:

<Select value={props.selectedData}>
  {props.availableData.map((option) => (
  <option value={option.symbol}>{option.symbol}</option>
  ))}
</Select>

But the list if empty. What is the proper way to display the data?

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

0

You have to just put the ternary operator condition you have both ways

1.

{
props.availableData ?
<Select                            
    value={props.selectedData}>
    {props.availableData.map((option) => (
        <option value={option.symbol}>{option.symbol}</option>
    ))}
</Select>:null
}
{
props.availableData.length === 0 ?
<Select                            
    value={props.selectedData}>
    {props.availableData.map((option) => (
        <option value={option.symbol}>{option.symbol}</option>
    ))}
</Select>:null  
}
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