tbleckert / react-select-search

⚡️ Lightweight select component for React
https://react-select-search.com
MIT License
675 stars 149 forks source link

When I use getOptions fetch - not working event onChange #160

Closed smartcoder01 closed 3 years ago

smartcoder01 commented 3 years ago
<SelectSearch
     options={[]}
    getOptions={(query) => {
        return new Promise((resolve, reject) => {
            fetch(`https://www.thecocktaildb.com/api/json/v1/1/search.php?s=${query}`)
                .then(response => response.json())
                .then(({ drinks }) => {
                    resolve(drinks.map(({ idDrink, strDrink }) => ({ value: idDrink, name: strDrink })))
                })
                .catch(reject);
        });
    }}
      onChange={(e)=>{
          alert(e)
      }}
      search
  />
tbleckert commented 3 years ago

@smart-coder-ru Fixed in v3.0.4