sickdyd / react-search-autocomplete

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

What is the way to check that the Search is empty after backspace clicks not by Clear? #72

Closed Rahulgarg30591 closed 1 year ago

Rahulgarg30591 commented 2 years ago

Unable to trigger an event in a case when the Search String is all empty as the onSearch event is not triggering on the removal of the last character.

Similar to: https://github.com/sickdyd/react-search-autocomplete/issues/17#issuecomment-831743898

I need to verify whether the textbox is empty or not as part of validation.

Thank you,

rserafim commented 1 year ago

Same!

sickdyd commented 1 year ago

Screen Shot 2022-09-25 at 8 59 52 @Rahulgarg30591 @rserafim Did you try with the lastest version?

I can see that onSearch is triggered also when the last character is removed. Check this codesandbox.

Since the thread is fairly old I'll close it for now. Feel free to re-open if you have something to add.