React | Conditional Rendering | Question 4

Last Updated :
Discuss
Comments

Which is the correct way to return multiple elements conditionally?

{isValid && (<p>Hello</p> <p>World</p>)}

{isValid && [<p>Hello</p>, <p>World</p>]}

{isValid && (<><p>Hello</p><p>World</p></>)}

{isValid ? <p>Hello</p><p>World</p> : null}

Share your thoughts in the comments