refactor(frontend): simplify JSX conditional rendering

JSX conditional rendering can be simplified to use the logical AND
operator (&&) [1] instead of ternary operator (? :) if we want to render
something only when the conditon is true, and nothing otherwise.

[1]: https://react.dev/learn/conditional-rendering#logical-and-operator-

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2023-10-14 13:39:23 +08:00
parent e5e5a42736
commit 0efc2277dd
3 changed files with 17 additions and 29 deletions

View File

@@ -92,7 +92,7 @@ export default function ConversationTile({
</p>
)}
</div>
{conversationId === conversation.id ? (
{conversationId === conversation.id && (
<div className="flex">
<img
src={isEdit ? CheckMark : Edit}
@@ -122,7 +122,7 @@ export default function ConversationTile({
}}
/>
</div>
) : null}
)}
</div>
);
}