How could this conditional statement be simplified? Return statement is being used multiple times. Could for example ternary operators be used in this case?
Is returning null a proper way to hide Components?
import Item from './Item';
const Component = ({data, onChange}) => {
if (data) {
const items = data.map(( item ) => {
return <Item onChange={ onChange } />
});
return(
<ul>{items}</ul>
);
} else {
return(null);
}
}
export default Component;