Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return React.Children.map(children, (child, index) => {
let isSelectable = true;
if (child.props.isSelectable === false) {
isSelectable = false;
}
return React.cloneElement(child, {
isSelectable,
isSelected: this.state.selectedIndex === index,
onClick: Utils.wrappedOnClickForItem(child.props.onClick, this.handleItemSelection, { index }),
onKeyDown: Utils.wrappedOnKeyDownForItem(child.props.onKeyDown, this.handleItemSelection, { index }),
});
});
}