title: How do I properly map array into <Text> (React native)
body: <p>I have an array that I need to map out in <code>&lt;Text&gt;</code>. This is what I've got in <code>render()</code></p>
  
  <pre><code>categories.map(category =&gt; &lt;Text&gt;{category.testHeader}&lt;/Text&gt;
  </code></pre>
  
  <p>But it doesn't print anything. I guess <code>&lt;Text&gt;</code> needs to be in <code>render()</code> right? So I tried adding it in a function to be called in <code>render</code>. Like this: </p>
  
  <pre><code>function myfunc() {
      return categories.map(category =&gt; &lt;Text&gt;{category.testHeader}&lt;/Text&gt;)
  }
  </code></pre>
  
  <p>Then in <code>render()</code>:</p>
  
  <pre><code>&lt;View&gt;
      {myfunc()}
  &lt;/View&gt;
  </code></pre>
  
  <p>But then the compiler said `Cannot read property 'map' of undefined. SO tips told me to put write:</p>
  
  <pre><code>function myfunc() {
      if (this.props.data) {
          return categories.map(category =&gt; &lt;Text&gt;{category.testHeader}&lt;/Text&gt;)
      }
  }
  </code></pre>
  
  <p>But now the compiler tells me that <code>data</code> is undefined. Not sure what to do here... :/</p>