reactjs / react-autocomplete

WAI-ARIA compliant React autocomplete (combobox) component
MIT License
2.17k stars 532 forks source link

It would be nice to make an additional parameter for key={...} #306

Closed AlexandrAnash closed 6 years ago

AlexandrAnash commented 6 years ago

It would be nice to make an additional parameter example

renderItem={(item, isHighlighted, style, **index**) => ()

Because you do not always want to specify a unique key Either make the default key={index} if key == null

In all examples, a key is prescribed by the hands :(

renderItem={(item, isHighlighted) => (
            <div
              className={`item ${isHighlighted ? 'item-highlighted' : ''}`}
              key={item.abbr}
            >{item.name}</div>
          )}
GDR commented 6 years ago

Don't use index as a key

AlexandrAnash commented 6 years ago

Thank!