I have several console errors because of this react function component, giving this error:
Select component MUI doesn't accept a Fragment as a child. Consider providing an array instead
function CustomSelectGrouping({ reportList, label }) {
return (
<FormControl sx={{ width: '100%' }}>
<InputLabel htmlFor="grouped-select">{label}</InputLabel>
<Select defaultValue="" id="grouped-select" label="Grouping">
{Object.keys(reportList).map((head) => (
<>
<ListSubheader>{head}</ListSubheader>
{reportList[head].map(({ id, name }) => <MenuItem value={id}>{`${id} - ${name}`}</MenuItem>)}
</>
))}
</Select>
</FormControl>
);
}
I've already tried using React.Fragment and Render() but none of them worked. Any ideas?