React | Conditional Rendering | Question 1

Last Updated :
Discuss
Comments

Which of the following is the correct way to conditionally render a component in React without rendering false or null to the DOM?

{condition && <MyComponent />}

{condition ? <MyComponent /> : null}

{condition && condition}

{condition || <MyComponent />}

Share your thoughts in the comments