react-typeahead
                                
                                
                                
                                    react-typeahead copied to clipboard
                            
                            
                            
                        Default option from list of objects?
If I provide an array of objects to Typeahead, like this:
var options = [{"id": "123", "name": "Hello"}, {"id": "456", "name": "world!"}];
How can I select a default/initial option when the options are an array of objects? If I provide the id as a defaultValue, the Typeahead field will render the id as text, but what I want to appear is the object's name as specified in "displayOption". I can't provide the name as a default value because it's possible that two unique objects with different IDs share the same name, and of course typeahead doesn't know which object I meant.
<Typeahead ref="typeahead"
               options={this.props.items}
               defaultValue={defaultVal.id}
               maxVisible={5}
               displayOption={(option, index) => {
                 return option.name;
               }}
               filterOption={"name"}
               formInputOption={"id"}
               onOptionSelected={this.handleChange} />
This is for a form to edit an existing entity where the user may not want to change their previous selection for this field.
did you found solution?