title: React Native: Access this.props Inside Function
body: <p>I managed to fetch data and show to UI with this code:</p>
  
  <pre><code>export default class BoxGarage extends Component {
      render() {
          let garage = this.props.garage;
          garage.name = garage.name.replace('strtoreplace', 'My Garage');
  
          let cars = garage.cars.length ?
              garage.cars.map((val, key) =&gt; {
                  return (
                      &lt;Car key={key} car={val} /&gt;
                  )
              }) : (
                  &lt;View style={styles.boxEmpty}&gt;
                      &lt;Text style={styles.textEmpty}&gt;(No Cars)&lt;/Text&gt;
                  &lt;/View&gt;
              );
  
          return (
              &lt;View style={styles.boxGarage}&gt;
                  &lt;Text&gt;{ garage.name }&lt;/Text&gt;
                  { cars }
              &lt;/View&gt;
          )
      }       
  }
  </code></pre>
  
  <p>Then I tried to change with a function, but no cars shown. What is missing?</p>
  
  <pre><code>export default class BoxGarage extends Component {
      render() {
          let garage = this.props.garage;
          garage.name = garage.name.replace('strtoreplace', 'My Garage');
  
          cars = function(garage) {
              if (garage.cars.length) {
                  garage.cars.map((val, key) =&gt; {
                      return (
                          &lt;Car key={key} car={val} /&gt;
                      );
                  });
              }
              else {
                  return (
                      &lt;View style={styles.boxEmpty}&gt;
                          &lt;Text style={styles.textEmpty}&gt;(No Cars)&lt;/Text&gt;
                      &lt;/View&gt;
                  );
              }
          }
  
          return (
              &lt;View style={styles.boxGarage}&gt;
                  &lt;Text&gt;{ garage.name }&lt;/Text&gt;
                  { cars(this.props.garage) }
              &lt;/View&gt;
          )
      }       
  }
  </code></pre>
  
  <p>And I think I should refactor for best practice either using constructor or just move the function outside render, but I don't know what it is. Please advice.</p>