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

231
Vistas
how to show array received from server in Autocomplete

I'm trying to show the user an array with the names that I get from the server. To allow the user to select the desired item from the list.

If I just write an array, then everything works.

   let liste=  
    [ 
       { label: 'The Shawshank Redemption', year: 1994 },
       { label: 'The Godfather', year: 1972 } 
    ]

 <Autocomplete
              disablePortal
              id="combo-box-demo"
              options={liste}
              onChange={(event , newevent) => {
              setBehoerdeName(newevent) }}
              renderInput={(params) => <TextField {...params} />}
  />

enter image description here

but if I get data from the server, it gives an error although I get an array too.

 let allDates = async function getAllDate() {
        let list = await axios.get("/myWay")
          if (list.data.success) {
            let finalList = list.data.json.map(({name1, ort, plz}) => ({name1, ort, plz}));
            return finalList
          } else {
            return null
          }
      };

 <Autocomplete
              disablePortal
              id="combo-box-demo"
              options={allDates }
              onChange={(event , newevent) => {
              setBehoerdeName(newevent) }}
              renderInput={(params) => <TextField {...params} label="Behörden" />}
   />

i get this error

Uncaught TypeError: options.filter is not a function

I tried to write data to a function and call it in options but the result is the same.

about 4 years ago · Juan Pablo Isaza
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