title: react triggers onclick when component is mounted
body: <p>I am passing a component to a nested component a <code>onClick</code> method that modifies the state of the parent component.</p>
  
  <p>Somehow the method is being called when a component (not sure if it's parent or child) is being mounted. And now, I'm getting the following error message:</p>
  
  <blockquote>
    <p>Uncaught Error: Invariant Violation: setState(...): Cannot update
    during an existing state transition (such as within <code>render</code>). Render
    methods should be a pure function of props and state.invariant</p>
  </blockquote>
  
  <p>The code for passing the child looks like the following</p>
  
  <pre class="lang-jsx prettyprint-override"><code>    var playlists = this.props.data.map(function(playlist) {
        return (
          &lt;PlaylistItem key={playlist.id}
                        data={playlist}
                        showPlaylistCode={this.getPlaylistCodeData} 
          /&gt;
        );
      }.bind(this));
  </code></pre>