mardi 17 décembre 2019

React Native - If else condition to change button

I have a condition on button change. If I click Booking Menu button and accommodate in this.state.bookpage, the button will change to Booking Now. The problem is when I click the Booking Menu, the button doesn't change still on Reserve Now button. Help me to fix this, thank you.

here is my code.

this.state.unitpage ? (
  <Button>
    <Text>Reserve Now</Text>
  </Button>
) : this.state.bookpage ? (
  <Button>
    <Text style>Booking Now</Text>
  </Button>
) : null;

Aucun commentaire:

Enregistrer un commentaire