title: How to change button on pressed color in multiple buttons React Native
body: <p>I have 3 buttons in my react native app. When user clicks button 1 I need to change it color to orange. But other buttons should have the default color (grey). If user clicks the button 3 next time, color should change to orange ,but that 1st button color should reset to default. I'm totally new to react native and this is what I tried. But it applies for all buttons. I know if I can have multiple states with unique Id , it can be done. But I don't know the method.</p>
  
  <pre><code>&lt;Text style={ styles.switchButtonsTitle }&gt;Choose Type of User&lt;/Text&gt;
  &lt;TouchableOpacity onPress={(userType) =&gt;
      this.selectionOnPress("BASIC")} &gt;
      &lt;Text style={_style}&gt;
          &lt;Text style={styles.switchButtonsText}&gt;BASIC&lt;/Text&gt;
      &lt;/Text&gt;
  &lt;/TouchableOpacity&gt;
  
  
  &lt;TouchableOpacity onPress={(userType) =&gt;
      this.selectionOnPress("INTERMEDIATE")}&gt;
      &lt;Text style={_style}&gt;
          &lt;Text style={styles.switchButtonsText}&gt;INTERMEDIATE&lt;/Text&gt;
      &lt;/Text&gt;
  &lt;/TouchableOpacity&gt;
  
  &lt;TouchableOpacity onPress={(userType) =&gt;
      this.selectionOnPress("ADVANCED")}&gt;
      &lt;Text style={{backgroundColor: this.state.backgroundColor}}&gt;
          &lt;Text style={styles.switchButtonsText}&gt;ADVANCED&lt;/Text&gt;
      &lt;/Text&gt;
  &lt;/TouchableOpacity&gt;
  </code></pre>
  
  <p>selectionOnPress</p>
  
  <pre><code>selectionOnPress(userType) {
      this.setState({
          onClicked: true
      });
  } 
  </code></pre>
  
  <p>props</p>
  
  <pre><code>constructor(props) {
      super(props);
      this.state = {
          onClicked: false
      }
      this.selectionOnPress = this.selectionOnPress.bind(this)
  }
  </code></pre>
  
  <p>render(not adding the all codes, only added the useful codes for this post)</p>
  
  <pre><code>render() {
      var _style;
      if (this.state.onClicked) { // clicked button style
          _style = {
              backgroundColor: "red"
          }
      }
      else { // default button style
          _style = {
              backgroundColor: "blue"
          }
      }
  </code></pre>