i did this ternary operator and this works but i know it could be better. If anyone can help me to refactor this code, that will be great
disabled={ mainCurrency.code
? currency.code
? currency.code === mainCurrency.code
? true
: false
: true
: true
}
So if mainCurrency is not set or currency is not set or mainCurrency is equal to currency than it is true. Writing it out would be
!mainCurrency.code || !currency.code || currency.code === mainCurrency.code