React | Conditional Rendering | Question 1

Last Updated :
Discuss
Comments

Which of the following is the correct way to use conditional rendering in React with an if statement?

if (condition) { return <Component />; }

if (condition) { return Component() }

if condition return <Component />

if (condition) return <Component /> else return null

Share your thoughts in the comments