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

230
Views
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
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!