This is the flatMap
:
const choices = names.flatMap(
(item) => item.name + " - " + item.size + "- " + item.category
);
console.log(choices)
:
https://i.stack.imgur.com/MO4b1.png
If the item.category
is equal to S-XL
, how can I prevent its values from being displayed? However, if the item.category
is equal to ft
, it will display the item.category
. Any assistance would be greatly appreciated. Thank you.
I'll be utilizing the flatMap
function here:
<Autocomplete
disablePortal
isOptionEqualToValue={(option, value) => option?.label === value?.label}
id="combo-box-demo"
options={choices}
fullWidth
value={value}
onChange={onChange}
renderInput={(params) => <TextField {...params} label="Products" />}
required
/>