score:0

Accepted answer
// in the Autocomplete component...
onClick = (e) => {
    this.setState({
      activeSuggestion: 0,
      filteredSuggestions: [],
      showSuggestions: false,
      userInput: e.currentTarget.innerText
    });
    this.props.onClick(e.currentTarget.innerText);
  };

/* ... */

render () {
  /* ... */
  // the input element now calls the internal onClick, seen above, which only then calls our props onClick method
  return (
      <React.Fragment>
        <input
          type="search"
          onChange={onChange}
          onKeyDown={onKeyDown}
          value={userInput}
          onClick={this.onClick}
        />
        {suggestionsListComponent}
      </React.Fragment>
    );
}

Related Query

More Query from same tag