sickdyd / react-search-autocomplete

A search box that filters the provided array of objects
https://sickdyd.github.io/react-search-autocomplete
MIT License
220 stars 84 forks source link

Setting value of searchInput or clear input field without clear icon #20

Closed lindaerin closed 2 years ago

lindaerin commented 3 years ago

How can I manually set the value of the searchInput field with inputSearchString? I have a placeholder value and onSelect event handler but want to clear input field when my onChange handler for my dropdown component is fired. It is not letting me do that with inputSearchString. I essentially want to be able to clear the input field without pressing the clear icon

sickdyd commented 3 years ago

@lindaerin Hello!

You might want to take a look at this issue: https://github.com/sickdyd/react-search-autocomplete/issues/17

Codesandbox: https://codesandbox.io/s/distracted-fermat-zo6r8?file=/src/App.js

Let me know if it fixes your problem.