react-select-search
react-select-search copied to clipboard
additional steps in onChange
const [selected, setSelected] = useState('');
<SelectSearch
options={[]}
value={selected}
onChange={setSelected}
getOptions={(query) => {
return new Promise((resolve, reject) => {
HTTP_API().get(url)
.then((response) => {
if (response.status === 200) {
resolve(response.data.map(({ id, name }) => ({
value: id,
name: name
})));
}
})
.catch(reject);
});
}}
search
placeholder="To: "
/>
how to add additional steps on onChange and retain its original behaviour? I tried the above code but every time I select an item it closes the dropdown and does not show the selected option. this is my current version 4.1.2
If I omit the value and onChange properties, the value displays for the selected option but I cannot get and use the value of the selected option.