How to set input value using downshift in reactjs

1k views Asked by At

I'm creating autocomplete input text box using downshiftjs. When the result of autocomplete is clicked, I can't set the input text.

I'm creating the sample code codesandbox.io

The autocomplete is working:

enter image description here

And it's searchable:

enter image description here

When I click the item, I can't set the input box value with the item I clicked.

1

There are 1 answers

2
Ilya Molostov On BEST ANSWER

You mast define itemToString function in hook, because you use array of object as select items. And some fix in <li> markup.

Edited working example: https://codesandbox.io/s/reverent-kepler-4v42x?file=/src/App.js