and also now I desire to remove two courses if prop.mail is set to false, therefore a sane way of law that would look choose this:

if.this.props.mail ? : null yet there space 2 routes and React returns error:

expressions must have one parental element.

I don"t want to usage multiple ifs here. What"s the desired React method of managing this?

You are watching: Jsx expressions must have one parent element



Put castle in variety (assign the secrets also):

if.this.props.mail ? < , >: null With recent React version, you can try React.Fragment also, favor this:

if.this.props.mail ? , : null


See more: How To Solve Apex Legends Hd Texture Download Stuck At 99%, Hd Texture Download Stuck On Downloading At 29%


You have the right to leverage short hand fragments to return a list of children together with Logical "&&" Operator because that conditional rendering. Nice and clean!