title: how to access vairables outside of map function in js and jsx in a React component
body: <pre><code>var PieceList = React.createClass({
  
    render: function() {
  
      var pieces;
      if (this.props.pieces &amp;&amp; this.props.onDeletePiece2) {
        var pieces = this.props.pieces.map(function (piece) {
          return (
            &lt;Piece pieceData={piece} onDeletePiece3={this.props.onDeletePiece2} /&gt;
          )
        });
      }
      return (
        &lt;div className="piecesTable"&gt;
          {pieces}
        &lt;/div&gt;
      );  
    }
  });
  </code></pre>
  
  <p>I'm stumped as to how to get this to work. The problem is that {this.props} is not available inside of the map function.</p>
  
  <p>Would a foreach be better here?  stumped, pls halp!</p>