title: How to access state from a function
body: <pre class="lang-js prettyprint-override"><code>this.state = {
              color: {
                B: '#FFB1C2', // RED
                C: '#A7EBEB', // GREEN
                D: '#99BFFF', // BLUE
                E: '#F9C499', // ORANGE
                F: '#B2A9A7', // BROWN
                DEFAULT: '#B7C7CE' // DEFAULT
              }
  }
  
  changeChartColor = (color) =&gt; {
     this.setState({ B: color.hex })
  };
  </code></pre>
  <p>I'm using a react library to change color from screen, <code>(color)</code> at the function responds with <code>color</code> I picked data. How can I access <code>this.state.color.B</code> at the <code>changeChartColor</code> function?</p>