const listOptions = filteredOptions.map((item) => (
<Combobox.Option value={item.label} key={`${item.id}`}>
{item.label}
</Combobox.Option>
));
return (
<Combobox
onOptionSubmit={(value, (Ideally key is here) => {
console.log('value', value);
console.log('key', key); <-- how do I fetch this value?
}}
given that my key is the ID of my item I would like to get the key value from my Combobox.Option. I currently can not find any elegant way to do this. are there any suggestions?
2
Answers
Because keys are are internal to react and are not accessible. I had to do a workaround of {value}__{id} then parse the Id off of the value for the client facing portion then parse the ID for my api portion