Closed mhutfield-Itrinegy closed 4 years ago
You can use getOptions
:
<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);
});
}}
search
placeholder="Your favorite drink"
/>
Thanks
Thanks, was looking for the same question
is there some event to hook into for when the input box is typed into, the onChange event only seems to fire when you actually select something from the dropdown list. Thanks