samedi 7 août 2021

React Native Case Statement, If statement or Conditional Rendering Based on Value

I'm trying to create rank levels based on the users account XP which I get from firestore. So if the user has 3000XP he'll be level 3 for example.

I assume the best case for this would be to build a long if statement with all the possible values for example:

if (CurrentAccountXP == '1000') {
return 1
} else if (CurrentAccountXP == '2000') {
return 2
}

etc etc

Aucun commentaire:

Enregistrer un commentaire