M

Mr. Dubey • 100.28K Points
Coach

Q. How can you conditionally render a component in React?

  • (A) Using if statement outside JSX
  • (B) Using ternary operator or logical && inside JSX
  • (C) Using a loop
  • (D) You cannot conditionally render in React
  • Correct Answer - Option(B)
  • Views: 26
  • Filed under category React Js

Explanation by: Mr. Dubey
Conditional rendering in JSX is commonly done using ternary or &&.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics