Retrieve element's key in React
<p>In a React component I've created, I have this inside the <code>render</code> method return value:</p>

<pre><code>this.props.albums.map(function(albumDetails, id) {
    return (&lt;div className="artistDetail" key={id} onClick={component.getTracks}&gt;
        &lt;img src={albumDetails.imageSrc} /&gt;
        &lt;p&gt;&lt;a href="#" &gt;{albumDetails.name}&lt;/a&gt;&lt;/p&gt;
    &lt;/div&gt;)
</code></pre>

<p>If I didn't specify a key, React warned me to do so. So I did. I then specified <code>onClick</code> event handler:</p>

<pre><code>getTracks: function (e) {
   console.log(e.target.key);
},
</code></pre>

<p>in hope I can get the  <code>&lt;div&gt;</code> key attribute I created. This does not work, however (I get some HTML output for <code>e.target</code> but nothing for <code>e.target.key</code>). How can I get the <code>key</code> attribute off an element that I've clicked on?</p>