title: How to update react variable state?
body: <p>I am trying to update the state of the variable "selectedPlayer" however when I setState function the state of this variable does not update, I have tested this through console logs as you can see below. </p>
  
  <p>Below is how I am trying to set the state of the variable and the some of this class file for your knowledge</p>
  
  <pre><code> this.setState({ selectPlayer: player });
  </code></pre>
  
  <p>this is some of the Component file and a function which i am using to update the state.</p>
  
  <pre><code>  class StatApp extends Component {
        constructor(props) {
          super(props);
          this.state = {
  
            selectedPlayer: 'dassdasda',
  
          };
          this.selectPlayer = this.selectPlayer.bind(this);
        }
  
      selectPlayer = e =&gt; {
          e.preventDefault();
          //  console.log(e.target.value); //will give you the value continue
  
          // Store Value
          const selectPlayer = this.state.selectedPlayer;
          console.log(this.state.selectedPlayer);
  
          console.log(selectPlayer);
  
          // Test to see if we are getting the value from the playerButton 
          const player = e.target.value;
          console.log(player);
  
  
          this.setState({ selectPlayer: player });
  
          console.log(selectPlayer);
  
        };
  </code></pre>