manuelBetancurt
manuelBetancurt

Reputation: 16138

typescript react style conditional with 2 conditions

I have a conditional for styling that works with only one condition:

<View
          style={[
            message.sender.isSystem && styles.systemMessageLine,
            message.data.mine && styles.yourMessageLine,
          ]}
>

Now if I want to have 2 conditionals how will I format that?

    <View
          style={[
            (!message.data.mine && !message.sender.isSystem) && styles.thirdPartyMessage
          ]}
    >

is the operator

&&

valid to concatenate 2 conditions?

Upvotes: 0

Views: 396

Answers (1)

basarat
basarat

Reputation: 275927

is the operator && valid to concatenate 2 conditions?

Yes.

Also your formatting is correct 🌹

Upvotes: 1

Related Questions