mathjazz / pontoon

In-place localization tool
https://pontoon.mozilla.org/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Use the logical && operator when conditionally rendering a component #1278

Open mathjazz opened 3 years ago

mathjazz commented 3 years ago

This issue was created automatically by a script.

Bug 1692699

Bug Reporter: @abowler2 CC: @mathjazz

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

N/A

Actual results:

N/A

Expected results:

Currently when a component is rendered conditionally we are using the ternary operator:

!condition ? null : <component>

Using the logical && operator would be a cleaner way to accomplish this:

condition && <component>

There are already some uses of the logical && operator that have been introduced in the code. In order to keep consistency we should consider replacing the ternary operator uses with the logical && operator.