Closed Bug 1692699 Opened 4 years ago Closed 4 years ago

Use the logical && operator when conditionally rendering a component

Categories

(Webtools Graveyard :: Pontoon, enhancement, P4)

enhancement

Tracking

(Not tracked)

RESOLVED MOVED

People

(Reporter: abowler, Unassigned)

Details

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.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P4
*This bug has been moved to GitHub.* *Please check it out on https://github.com/mozilla/pontoon/issues.*
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → MOVED
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.