I know that when we use the "&&", the logic is like this:{ boolean && action } -> if the boolean is true then return the "action". In my code it happens like this: if the src
property exists, then return the <Avatar />
. My question is: why is it like this? src doesn't have any true or false value. Why it happens like this ?
function Sidebar({src}) {
return (
<div>
{src && <Avatar src={src} />}
</div>
)
}