Home > Mobile >  Having problem on how to give condition if the Data = N/A then it will get disappear?
Having problem on how to give condition if the Data = N/A then it will get disappear?

Time:07-29

I'm having a problem on how to make the reason get disappear if API data for reason is N/A. Currently I'm using the below code and it is not working. Please do help me out.

{invoiceInfo.reason !== N/A ? (
   <Text style={[GlobalStyle.ReceiptDeclinedReason]}>Reason: {invoiceInfo.reason}</Text>
 ) : N/A}

API Data:

enter image description here

CodePudding user response:

change to:

{invoiceInfo.reason !== "N/A" ? (
   <Text style={[GlobalStyle.ReceiptDeclinedReason]}>Reason: {invoiceInfo.reason}</Text>
 ) : <></>}

  • Related