Reputation: 47
I want to add this line that says that the ninja is a master but only if the belt is red or black. I think I'm mixing up this type of function I'm trying to use.
<div>{isMaster = () => {
if (n.belt === "black" || n.belt === "red") {
return "Master";
} else {
return null;
}
}}</div>
Upvotes: 1
Views: 64
Reputation: 22875
You just need one line. Don't create a function there
<div>{(n.belt === "black" || n.belt === "red") && "Master"}</div>
Upvotes: 2
Reputation: 15146
<div>
{(n.belt === "black" || n.belt === "red") && "Master"}
</div>
Upvotes: 2