If you return MenuItem in Array.map, error occur when I press Select.
Code
const MenuItems: React.FC<{ items: number[] }> = (props) => {
const { items } = props;
return (
<>
{items.map((i) => {
return (
<MenuItem key={i} value={i}>
{i}
</MenuItem>
);
})}
</>
);
};
Error
Warning: Function components cannot be given refs. Attempts to access this ref will fail.
Did you mean to use React.forwardRef()?
So I want to rewrite it to forwardRef, but I don't know the type of ref. Is it possible to use forwardRef for MenuItem in the first place?
Thank you.