title: How to use const in if (React Native)
body: <p>I want to use const inside if(conditional branch),
  but I couldn't set const in if.</p>
  
  <p>Is there a way to use const or set a variable in a conditional branch?
  Or are there any problems of my code?</p>
  
  <p>Could you give some advice please? </p>
  
  <pre><code>export default class ApplauseButton extends Component {
  
    constructor(props) {
      super(props);
      this.state = {
        count: 0,
        applause: 100,
        applauded: 0,
      };
    }
  
    handlClick= async ()=&gt; {
        const {
          mainuser,
          subuser,
        } = this.props;
  
        if (mainuser === 'User1'){
          const countapplauded = this.state.applauded + 1;
        } else if (mainuser === 'User2') {
          const countapplauded1 = this.state.applauded1 + 1;
        }
    };
  
    render() {
      const {
        mainuser,
        subuser,
      } = this.props;
  
      return (
        &lt;View style={styles.container}&gt;
          &lt;TouchableHighlight
            onPress={() =&gt; {this.handlClick()}}
            onLongPress={this._onLongPressButton} underlayColor="white"&gt;
            &lt;View style={styles.button}&gt;
              &lt;Text style={styles.buttonText}&gt;&lt;/Text&gt;
            &lt;/View&gt;
          &lt;/TouchableHighlight&gt;
        &lt;/View&gt;
      );
    }
  }
  
  </code></pre>