I'm using React with Material-UI. I'm developing a simple UI in a form of a dropdown menu. I'd like to control the rendering of the first row with condition passed as a prop. How can I use the condition to render or skip rendering of the first row?
export const NativeSdkMenu = memo(({ showFirstMenuItem }) => (
<Menu>
<MenuItem component="a" href={link1}>
{"First"}
</MenuItem>
<MenuItem component="a" href={link1}>
{"Second"}
</MenuItem>
<MenuItem component="a" href={link1}>
{"Third"}
</MenuItem>
<MenuItem component="a" href={link1}>
{"Fourth"}
</MenuItem>
</Menu>
));
Obviously this doesn't work:
if (showFirstMenuItem) {
<MenuItem component="a" href={link1}>
{"First"}
</MenuItem>
}
I've tried a few similar approaches, but it looks like I need to use some specific JSX syntax which I don't know.