title: how to get the value of id
body: <p>I have a component with <code>id</code> property and I would like to get the value of the <code>id</code>. Here is my work.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>constructor(props) {
      super(props);
  
      this.state = {
  
        data: []
  
      }
      populate() {
  
  
        for (let i = 0; i &lt; 5; i++) {
  
          data.push( &lt; ChildComponent id = {
              i
            }
            /&gt;)
  
          }
        }
  
        getValue() {
  
          let tmp = data[0]
  
          alert(tmp.id)
  
        }
  
        render() {
          {
            this.populate
          }
  
          return (
  
            &lt;
            Button onClick = {
              this.getValue
            } &gt; alert ID &lt; /Button&gt;
  
          )
        }
  
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><code>populate()</code> inserts five childcomponent to data.</p>
  
  <p><code>getValue()</code> is where I want to alert id of the component.</p>
  
  <p><code>undefined</code> is being alerted</p>