Hi I'm having difficulty in implementing data-attribute in autocomplete suggestion items.
The problem is i need more info in of the selected suggestion, not just the ID.
The code below works but it doesn't solve the problem because the data attributes were set in the li's children element.
How do i add custom data-attribute to HTMLLIElement? TIA
const itemRender = (li: React.ReactElement<HTMLLIElement>, itemProps: ListItemProps) => {
const itemChildren = (
<div className="autocomplete-suggestion"
data-employeeid={`${itemProps.dataItem.memberInfo.employeeID}`}
onClick={ (e) => e.preventDefault()}
>
{li.props.children}
</div>
);
return cloneElement(li, li.props , itemChildren);
};