how to make Firstname selected from both Firstname and Lastname in display (Label key) Typeahead React

295 Views Asked by At

How to select the first name only (i.e selected should be Firstname), when both first name and last name is in display (Label key ) in type ahead react.

     <Typeahead
    id="typeahead"
      labelKey={option => `${option.firstName} ${option.lastName}`}
      options={[
      { id: 1, firstName: "Art", lastName: "Blakey" },
      { id: 2, firstName: "John", lastName: "Coltrane" },
      { id: 3, firstName: "Miles", lastName: "Davis" },
      { id: 4, firstName: "Herbie", lastName: "Hancock" },
      { id: 5, firstName: "Charlie", lastName: "Parker" },
      { id: 6, firstName: "Tony", lastName: "Williams" }
    ]}
    placeholder="Selected Value must be FirstName"

  />
0

There are 0 best solutions below