Skip to content

Commit 52c5682

Browse files
committed
Pass the itemIndex to the renderItem function
1 parent a9bc179 commit 52c5682

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/Item.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,9 @@ export default class Item extends Component {
5151
};
5252

5353
render() {
54-
const { isHighlighted, item, renderItem, renderItemData, ...restProps } = this.props;
54+
const { isHighlighted, item, itemIndex, renderItem, renderItemData, ...restProps } = this.props;
5555

5656
delete restProps.sectionIndex;
57-
delete restProps.itemIndex;
5857

5958
if (typeof restProps.onMouseEnter === 'function') {
6059
restProps.onMouseEnter = this.onMouseEnter;
@@ -74,7 +73,7 @@ export default class Item extends Component {
7473

7574
return (
7675
<li role="option" {...restProps} ref={this.storeItemReference}>
77-
{renderItem(item, { isHighlighted, ...renderItemData })}
76+
{renderItem(item, { itemIndex, isHighlighted, ...renderItemData })}
7877
</li>
7978
);
8079
}

0 commit comments

Comments
 (0)