title: Getting ID from div in React.js
body: <p>So I'm trying to retrieve data in a div attribute in react. JSFiddle shows the problems I'm having. this.state.value is set to an empty string after the event fires. </p>
  
  <p>I started off using the data-* attribute for the div after reading <a href="https://stackoverflow.com/questions/5309926/how-to-get-the-data-id-attribute">another stack overflow post</a>, but I cannot use jQuery, so I switched to id. Any ideas?</p>
  
  <p><a href="https://jsfiddle.net/boloneyshinobi/yw6db9ts/1/" rel="nofollow noreferrer">JSFiddle</a></p>
  
  <pre><code>class GettingAttributes extends React.Component {
    constructor(props) {
      super(props)
      this.state = {value: 'Hello!'};
  
      this.bar = this.bar.bind(this);
    }
  
    bar(e){
      this.setState({value: e.target.id})
    }
  
    render() {
      return (
        &lt;div id="foo" onClick={this.bar}&gt;
          &lt;p&gt;{this.state.value}&lt;/p&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>