class Component extends React.Component {
const a = true
render() {
return (
{a == true
? ()
: null
}
)
}
}
This is staying: if a == true, render a button component.
Otherwise render null, in other words nothing.
Example 3: react native conditional rendering
function Mailbox(props) {
const unreadMessages = props.unreadMessages;
return (