title: How to call a function with onPress ? React Native TouchableOpacity
body: <p>I am currently trying to make an app with React Native but I am facing a problem that i don't understand.</p>
  <p>I want to get the id of the element the user touched, I try to do this using a onPress in a</p>
  <pre><code>      tasks.map(element =&gt; {
          return (
            &lt;TouchableOpacity onPress={(element) =&gt; getTouchedId(element)}&gt;
               &lt;Note text={element.text} color={element.color} setpositionX={setpositionX} setpositionY={setpositionY}/&gt;
            &lt;/TouchableOpacity&gt;
          )
        })}
  </code></pre>
  <p>So onPress call getTouchedId and pass element as a parameter.</p>
  <p>Here is my getTouchedId function :</p>
  <pre><code>  const getTouchedId = (element) =&gt; {
      console.log(&quot;element.id : &quot; + element.id)
      settouchedId(element.id)
    }
  </code></pre>
  <p>So here you can see my function, I dont understand why I am never seeing my <code>console.log(&quot;element.id : &quot; + element.id)</code> I think the problem is that my function is never red and I don't understand why (the value of <code>touchedId</code> with <code>settouchedId</code> also never changes).</p>