title: OnClick event on React table row
body: <p>Hello first question and beginner React user here.  I followed this (<a href="https://stackoverflow.com/questions/37771316/react-triggering-click-event-on-table-row/37771414">React - Triggering click event on table row</a> ) example to have an onClick event on a React table but the first issue is I receive a warning in Visual Studio Code that Uncaught ReferenceError: e is not defined.  Any help would be appreciated.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>import React from 'react';
  import './gridStyle.css';
  
  class Grid extends React.Component {
  
      onClickHandler = () =&gt; {
          const song = e.target.getAttribute('data-item');
          console.log('We need to get the details for ', song);
      }
  
      renderResultRows(data) {
          return data.map((coord, index) =&gt;
              // anon func maintains scope!
              // Pass in a function to our onClick, and make it anon
              // to maintain scope.  The function body can be anything
              // which will be executed on click only.  Our song value
              // is maintained via a closure so it works.
              (
                  // eslint-disable-next-line react/no-array-index-key
                  &lt;tr key={index} data-item={coord} onClick={this.onClickHandler}&gt;
                      &lt;td data-title="cc"&gt;{coord.lat},{coord.lon}&lt;/td&gt;
                      &lt;td data-title="ic" /&gt;
                      &lt;td data-title="dlat" /&gt;
                      &lt;td data-title="dlon" /&gt;
                  &lt;/tr&gt;
              )); // no need to bind with anon function
      }
  
      render() {
          console.log('Coords passed in from Accuracy Calculator :', this.props.coords);
         return (
              &lt;div className="grid"&gt;
                  &lt;table id="table0"&gt;
                      {this.renderResultRows(this.props.coords)}
                  &lt;/table&gt;
              &lt;/div&gt;
          );
      }
  }
  
  export default Grid;
  </code></pre>