title: "this" is undefined inside map function Reactjs
body: <p>I'm working with Reactjs, writing a menu component.</p>
  
  <pre><code>"use strict";
  
  var React = require("react");
  var Menus = React.createClass({
  
      item_url: function (item,categories,articles) {
          console.log('afdasfasfasdfasdf');
          var url='XXX';
          if (item.type == 1) {
              url = item.categoryId == null ? 'javascript:void(0)' : path('buex_portal_browse_category', {slug: categories[item.categoryId].slug});
          } else if (item.type == 2) {
              url = item.articleId == null ? 'javascript:void(0)' : path('buex_portal_view_article', {slug: articles[item.articleId].slug, id: item.articleId});
          } else {
              url = item.url;
          }
          return url;
      },
  
      render: function () {
       //   console.log(this.props.menus);  // return correctly
              var menuElements = this.props.menus.map(function (item1) { // return fault : 'cannot read property 'props' of undefined '
              return (
                  &lt;div&gt;
                      &lt;li&gt;
                          &lt;a href={this.item_url(item1, this.props.categories, this.props.articles )}&gt;{item1.name} // the same fault above
                              &lt;i class="glyphicon glyphicon-chevron-right pull-right"&gt;&lt;/i&gt;
                          &lt;/a&gt;
                          &lt;div class="sub-menu"&gt;
                              &lt;div&gt;
                              {item1._children.map(function (item2) {
                                  return (
                                      &lt;div&gt;
                                          &lt;h4&gt;
                                              &lt;a href={this.item_url(item2, this.props.categories, this.props.articles)}&gt;{ item2.name }&lt;/a&gt;
                                          &lt;/h4&gt;
                                          &lt;ul&gt;
                                              {item2._children.map(function (item3) {
                                                  return ( 
                                                      &lt;div&gt;&lt;li&gt;&lt;a href={this.item_url(item3, this.props.categories, this.props.articles) }&gt;{ item3.name }&lt;/a&gt;&lt;/li&gt;&lt;/div&gt;
                                                  );
                                              })}                   
                                          &lt;/ul&gt;
                                      &lt;/div&gt;
                                  );
                              })}
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/li&gt;
                  &lt;/div&gt;
              );
          });
  
          return (
              &lt;div class="menu"&gt;
                  &lt;ul class="nav nav-tabs nav-stacked"&gt;
                      {menuElements}
                  &lt;/ul&gt;
              &lt;/div&gt;
          );
      }
  });
  </code></pre>
  
  <p>Whenever I use 'this' inside map function it is undefined, but outside it is no problem.</p>
  
  <p>The error: </p>
  
  <blockquote>
    <p>"Cannot read property 'props' of undefined"</p>
  </blockquote>
  
  <p>Anybody help me ! :((</p>