Switch to Dark Mode

React | Conditional Rendering | Question 8

Last Updated : Jan 27, 2025
Discuss
Comments

How would you write a conditional rendering to display a "Loading..." message if isLoading is true and show Content if it is false?

A

{isLoading && "Loading..." || "Content"}

B

{isLoading ? "Loading..." : "Content"}

C

{!isLoading && "Loading..." ? "Content" : ""}

D

{isLoading && return "Loading..." : "Content"}

Share your thoughts in the comments