title: React: Getting an object on click
body: <p>I have an array of objects which is passed as a property to a list that maps them to <code>&lt;li&gt;</code>.</p>
  
  <p>I would like to be able, for any individual item, to click on an item from the list, and receive that object and then assign it to the root component's state - so I could then pass it on to another child comp.</p>
  
  <pre><code>var Menu = React.createClass({
  render: function() {
      return (&lt;ul&gt;
          {
              this.props.posts.map(function(post){
                  return &lt;li&gt;&lt;a onClick={function(e){console.log(e)}}&gt;{post.title}&lt;/a&gt;&lt;/li&gt;
              })
          }
      &lt;/ul&gt;)
  }
  </code></pre>
  
  <p>})</p>
  
  <p><a href="https://jsfiddle.net/nbenita/yxw1z42q/" rel="nofollow">https://jsfiddle.net/nbenita/yxw1z42q/</a></p>
  
  <p>Thanks!</p>