I am facing an issue with mapping the values of field choices to create options for an MUI Select field from an array called fieldChoices
.
Here is how I populate the fieldChoices
array:
fieldChoices = {
choices: filtered_status.map(function (item) {
return {
id: item.IntakeID,
title: item.Title,
};
}),
};
The populated fieldChoices
array has a structure like this:
{choices: [{id: 123, title: "321"}, {id: 456, title: "654"}]}
This is my attempt at mapping the MenuItems:
<TextField value={ID || ""} select>
{fieldChoices?.choices?.map((index, e) => {
return (
<MenuItem key={index} value={e}>
{e}
</MenuItem>
);
})}
</TextField>