react-autosuggest
react-autosuggest copied to clipboard
[QUESTION] - Select suggestion programmatically
Hi,
Is there a way to select a suggestion programmatically?
What I am trying to accomplish is the following:
When a user types in the autosuggest, if there is a single match, select (click) that suggestion automatically.
Hope you guys can help!
Thanks!
Are you trying to achieve something similar? #658
@themakerman thanks for your comment, no I simply wanted to be able to call a function when a single match (suggestion) is available, and have it do something. In my case when I type something in the input and only 1 match appears, it automatically clicks on it. I was able to achieve it by putting a ref on the suggestions and calling the ref.click(). Its not ideal but it works. I was wondering if there was any other way that would be better to do it.
So do u have any suggestions for my issue?
I've got the same issue. Our use case is to create a new item from a dialog. We'd like to have it insert the new one into the list and have it be selected.