OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

multiple condition in ternary operator in jsx

  • Thread starter Thread starter Jenny Mok
  • Start date Start date
J

Jenny Mok

Guest
Code:
<div style={{'backgroundColor': status === 'approved' ? 'blue' : 'black'}}>
</div>

black is the default color but what if I want to add the 3rd condition?

status can be 'approved', 'rejected', 'pending' or more.

<pre><code><div style={{'backgroundColor': status === 'approved' ? 'blue' : 'black'}}>
</div>
</code></pre>

<p>black is the default color but what if I want to add the 3rd condition? </p>

<p>status can be 'approved', 'rejected', 'pending' or more.</p>
 

Latest posts

Top