title: React-Native-Android: Pressing a button that will change the text depending on the button pressed
body: <p>Hello there I am still currently working on my simple calculator and I've got this set of codes that does the computation or functions/events</p>
  
  <pre><code>export default class App extends Component {
  constructor(props){
      super(props);
      this.state = {
          firstInput: '',
          secondInput: '',
          sum: 0,
          difference: 0,
          product: 0,
          quotient: 0,
          result: 0,
      };
  }
  
  
  //CALCULATIONS FORMULA
  
  calculateSum = () =&gt; {
      const { firstInput, secondInput } = this.state;
  
      this.setState({
          sum: Number(firstInput) + Number(secondInput)
      });
  }
  
  calculateDifference = () =&gt; {
      const { firstInput, secondInput } = this.state;
  
      this.setState({
          difference: Number(firstInput) + Number(secondInput)
      });
  }
  
  calculateProduct = () =&gt; {
      const { firstInput, secondInput } = this.state;
  
      this.setState({
          product: Number(firstInput) + Number(secondInput)
      });
  }
  
  calculateQuotient = () =&gt; {
      const { firstInput, secondInput } = this.state;
  
      this.setState({
          quotient: Number(firstInput) + Number(secondInput)
      });
  }
  
  
  
  //stores input from user
  storeFirstInput = (number1) =&gt; {
      this.setState({firstInput: number1})
  }
  
  storeSecondInput = (number2) =&gt; {
      this.setState({secondInput: number2})
  }
  </code></pre>
  
  <p>and this is the text that I want to change depending on which button is pressed</p>
  
  <pre><code>&lt;View style={styles.answerContainer}&gt;
                  {/****** ANSWER HOVERING TEXT ******/}
                  &lt;Text 
                  style = {{
                  fontWeight: 'bold',
                  fontSize: 30,
                  color: '#242582',
  
                  }}&gt; 
                  ANSWER: 
                  &lt;/Text&gt;
  
                  {/****** RESULT OF USER INPUT ******/}
                  &lt;Text 
                  style={styles.answerText}
  
                  &gt; 
                  {this.state.sum}
                  &lt;/Text&gt;
  
              &lt;/View&gt;
  </code></pre>
  
  <p>I've got 4 buttons namely +,-,* and / (sum, difference, product and quotient)</p>
  
  <pre><code>&lt;View style={styles.buttonContainer}&gt;
                  {/****** ADD BUTTON CONTAINER ******/}
                  &lt;View Style={styles.addButtonContainer}&gt;
                          &lt;TouchableOpacity Style={styles.addButtonDesign} 
                          onPress={this.calculateSum}
                          &gt;
                                  &lt;Text style ={styles.buttonText}&gt; + &lt;/Text&gt;
                          &lt;/TouchableOpacity&gt;
                  &lt;/View&gt;
  
                  {/****** SUBTRACT BUTTON CONTAINER ******/}
                  &lt;View Style={styles.subtractButtonContainer}&gt;
                          &lt;TouchableOpacity Style={styles.subButtonDesign}
                          onPress={this.calculateDifference}
                          &gt;
                                  &lt;Text style ={styles.buttonText}&gt; - &lt;/Text&gt;
                          &lt;/TouchableOpacity&gt;
                  &lt;/View&gt;
  
                  {/****** MULTIPLY BUTTON CONTAINER ******/}
                  &lt;View Style={styles.multiplyButtonContainer}&gt;
                          &lt;TouchableOpacity Style={styles.mulButtonDesign}
                          onPress={this.calculateProduct}
                          &gt;
                                  &lt;Text style ={styles.buttonText}&gt; * &lt;/Text&gt;
                          &lt;/TouchableOpacity&gt;
                  &lt;/View&gt;
  
                  {/****** DIVIDE BUTTON CONTAINER ******/}
                  &lt;View Style={styles.divideButtonContainer}&gt;
                          &lt;TouchableOpacity Style={styles.divButtonDesign}
                          onPress={this.calculateQuotient}
                          &gt;
                              &lt;Text style ={styles.buttonText}&gt; ÷ &lt;/Text&gt;
                          &lt;/TouchableOpacity&gt;
                  &lt;/View&gt;
  </code></pre>
  
  <p>and this is where the problem comes in! Whenever I press the -,* or / button it doesn't display the correct formula it always just displays the sum. Is there any way to do an IF statement somewhere in the code where IF buttonpressed is - it will put in {this.state.difference} in the text section of my code? Any help will be highly appreciated! </p>