React | Conditional Rendering | Question 6

Last Updated :
Discuss
Comments

What will be the output of the following code?

JavaScript
{
    condition1 ? <Component1 /> :
    condition2 ? <Component2 /> : 
    <DefaultComponent />
}

It will render <Component1 /> if condition1 is true, otherwise <Component2 /> if condition2 is true, otherwise <DefaultComponent />

It will render <Component1 /> if condition1 is true, otherwise <Component2 />.

It will always render <Component1 />

It will never render anything.

Share your thoughts in the comments